设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 4874|回复: 9
打印 上一主题 下一主题

[窗体] 求助调用和关闭外部屏幕软键盘程序的方法。

[复制链接]

点击这里给我发消息

1#
发表于 2012-12-18 11:02:52 | 显示全部楼层
用API的方法如下:
  1. Private Declare Function SetFocusAPI& Lib "user32" Alias "SetFocus" (ByVal hwnd As Long)
  2. Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
  3. Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long

  4. Dim mpID As Long

  5. Private Sub Text2_GotFocus()
  6. On Error Resume Next
  7.     mpID = Shell(CurrentProject.Path & "\SoftBoard.exe", 1)
  8.     DoEvents
  9.     SetFocusAPI Me.hwnd
  10. End Sub

  11. Private Sub Text2_LostFocus()
  12.     Dim hP As Long
  13.     If mpID <> 0 Then
  14.         hP = OpenProcess(1&, -1&, mpID)
  15.         If TerminateProcess(hP, 1) <> 0 Then mpID = 0 '强制关闭程序
  16.     End If
  17. End Sub
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-15 03:45 , Processed in 0.104552 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表