关于api中,keybd_event中的参数 ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long里面 bvk 和bscan具体的参数(键盘码常数)有哪些? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 '附上老外的例程一段,自己研究吧,很简单的.... :)Const VK_H = 72Const VK_E = 69Const VK_L = 76Const VK_O = 79Const KEYEVENTF_EXTENDEDKEY = &H1Const KEYEVENTF_KEYUP = &H2Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Sub Form_KeyPress(KeyAscii As Integer) 'Print the key on the form Me.Print Chr$(KeyAscii);End SubPrivate Sub Form_Paint() 'KPD-Team 2000 'URL: http://www.allapi.net/ 'E-Mail: [email protected] 'Clear the form Me.Cls keybd_event VK_H, 0, 0, 0 ' press H keybd_event VK_H, 0, KEYEVENTF_KEYUP, 0 ' release H keybd_event VK_E, 0, 0, 0 ' press E keybd_event VK_E, 0, KEYEVENTF_KEYUP, 0 ' release E keybd_event VK_L, 0, 0, 0 ' press L keybd_event VK_L, 0, KEYEVENTF_KEYUP, 0 ' release L keybd_event VK_L, 0, 0, 0 ' press L keybd_event VK_L, 0, KEYEVENTF_KEYUP, 0 ' release L keybd_event VK_O, 0, 0, 0 ' press O keybd_event VK_O, 0, KEYEVENTF_KEYUP, 0 ' release OEnd Sub keybd_event函数我只用过一次,是模拟printscreen按键时用的,我具体用法是:申明api Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Public Const theScreen = 1Public Const theForm = 0然后, Call keybd_event(vbKeySnapshot, theScreen, 0, 0) ' 截取当前窗体所在屏幕图像 Call keybd_event(vbKeySnapshot, theform, 0, 0) ' 截取当前屏幕图像这是我从vb爱好者上学的,你也可以去看看http://www.sijiqing.com/vbgood/experience/index.asp?action=read&id=3313希望能对你有所帮助! 关于控件包含属性 如何检查硬盘路径上的文件是否存在? 求一解决方案。急。在线等 我在*.txt的文件里有两行数据。如何成图! ( 急!!! ) bit型数据在DataGrid中的显示问题 VB有什么好用的打印控件? 小弟刚学vb,编个计算器程序!可是有个问题!希望各位大侠帮忙! 我看了好多的帖子,到底谁能给我一个做好的扑克(纸牌)游戏的源程序啊??? 关于类的问题。我做了一个类。是关于数据库的,浏览好用。但是添加数据就不好用。来看看吧。对你有帮助的。 请教一个二进制运算问题! 请问,有没有这样的例表,把VB的每一个控件的属性和事件全部例出来,,以方便学习 VB开发的DLL,如何让其它语言调用
Const VK_E = 69
Const VK_L = 76
Const VK_O = 79
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Sub Form_KeyPress(KeyAscii As Integer)
'Print the key on the form
Me.Print Chr$(KeyAscii);
End Sub
Private Sub Form_Paint()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
'Clear the form
Me.Cls
keybd_event VK_H, 0, 0, 0 ' press H
keybd_event VK_H, 0, KEYEVENTF_KEYUP, 0 ' release H
keybd_event VK_E, 0, 0, 0 ' press E
keybd_event VK_E, 0, KEYEVENTF_KEYUP, 0 ' release E
keybd_event VK_L, 0, 0, 0 ' press L
keybd_event VK_L, 0, KEYEVENTF_KEYUP, 0 ' release L
keybd_event VK_L, 0, 0, 0 ' press L
keybd_event VK_L, 0, KEYEVENTF_KEYUP, 0 ' release L
keybd_event VK_O, 0, 0, 0 ' press O
keybd_event VK_O, 0, KEYEVENTF_KEYUP, 0 ' release O
End Sub
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const theScreen = 1
Public Const theForm = 0
然后,
Call keybd_event(vbKeySnapshot, theScreen, 0, 0) ' 截取当前窗体所在屏幕图像
Call keybd_event(vbKeySnapshot, theform, 0, 0) ' 截取当前屏幕图像
这是我从vb爱好者上学的,你也可以去看看
http://www.sijiqing.com/vbgood/experience/index.asp?action=read&id=3313
希望能对你有所帮助!