| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. VB sendkeys #711 Posted by: 2002-12-21 06:43:18 | Could someone translate the VB code bellow to rapidq ?
Private Sub Command1_Click() SendKeys "%{TAB}", False SendKeys "%E", False SendKeys "A", False SendKeys "%E", False SendKeys "c", False End Sub
| 2. RQ sendkeys #712 | RQ sendkeys example (by win32 api): http://g.slyip.com/_scripts/file.php?f=2677&r=2330
By the way, you may try the in-site search here by press alt-s, enjoy :) | 3. Re: RQ sendkeys #713 Posted by: 2002-12-22 00:57:13 | Sorry but sendkeys.bas doesn't good. I've try before my message.
There are problems that I suppose I have resolved 1 : SendMessage "already in use" >> SendMessage1 2 : "lparam as any" >> "lparam as long" 3 : keybd_event + "Alias "keybd_event"" 4 : sleep + "Alias "Sleep"" 5 : "Optional DelayMS As Long = 0" error >> DelayMS As Long (??) and other that I really don't know what to do. 6 : error "trying to assign reserved word BYTE" ??????
)o )O | 4. Modified #714 | I didn't verify it, sorry. Modified a little bit and passed compile. I don't have enough time to make a full demo. Welcome & thanks if you made that finally and put onto upload directory: http://g.slyip.com/_scripts/file.php?f=2677&r=2330 Hope helpful! | 5. Re: Modified #715 Posted by: 2002-12-22 23:26:37 | Not bad... I have launched it with lines added "SendKeyApi = 0", "ShowStartMenu", "End". It works but... the mouse and the keyboard give no responses for a while. After pressing a few keys I have take again the control of the keyboard. But it's a big problem...
And : where can I find the code for the "Alt" key (? vbKeyAlt). I have search on MSDN and not find it, except with visual basic.net wich have another syntax (closer c++ I think). | 6. Re: Modified #716 Posted by: 2002-12-22 23:50:22 | Here's a .exe Form with the same problem : no responding of the mouse of keyboard after the sendkeys. Pressing "Alt Gr" ends problem.
CREATE Form AS QFORM Caption = "Rapid-Q SendKeys" Width = 200 Height = 80 Center CREATE Button AS QBUTTON Caption = "SendKeys : Ctrl + Esc" Left = 25 Top = 10 width = 150 END CREATE
END CREATE
'Insert your initialization code here
'Modified by Guidance (http://citymap.126.com) 2002-12-22
'From: "Gregg Morrison" <greggmor@b...> Date: Sat Aug 31, 2002 5:24 am ' the API way to send keys to any window, so here it is: '----------------- 'Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd _ 'As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Sub keybd_event Lib "user32" alias "keybd_event" (ByVal bVk As Byte, ByVal bScan _ As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) ' This is cross-application SendKeys
'Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Const KEYEVENTF_KEYUP = &H2 ' Release key Public Const WM_SETFOCUS = &H7& ' &h0007 Public Const WM_KILLFOCUS = &H8& '&h0008
' set focus to any displayed window using hWnd = WindowHandle SendMessage hWnd, WM_SETFOCUS, 0&, 0&
' Send a string of keys with optional keypress delay ' This simulates pressing an releasing each key in the Byte Array 'bytKetStack()
Public Sub SendKeysAPI(bytKeystack() As Byte, _ 'Optional DelayMS As Long)' = 0) Dim nKeyCnt As Long
For nKeyCnt = LBound(bytKeystack) To UBound(bytKeystack) keybd_event bytKeystack(nKeyCnt), 0, 0, 0 ' Simulate KeyPress DoEvents ' let Windows Process Message If DelayMS Then Sleep DelayMS ' Delay - 0, 5, 10 milliseconds if needed
' Simulate KeyRelease keybd_event bytKeystack(nKeyCnt), 0, KEYEVENTF_KEYUP, 0 DoEvents ' Let Windows Process Message Next nKeyCnt
End Sub
' Here is an example using control keys defBYTE vbKeyControl = 17 ' CTRL key defBYTE vbKeyEscape = 27 ' ESC key
Public Sub ShowStartMenu()
' Press the Ctrl-Esc key - Same as the 'Windows' key keybd_event vbKeyControl, 0, 0, 0 keybd_event vbKeyEscape, 0, 0, 0 DoEvents
'Release the two keys keybd_event vbKeyControl, 0, KEYEVENTF_KEYUP, 0 keybd_event vbKeyEscape, 0, KEYEVENTF_KEYUP, 0 DoEvents
End Sub
Sub Envoi() SendKeyAPI = 0 ShowStartMenu End Sub
Button.OnMouseDown = Envoi Form.ShowModal | 7. Another VB example #717 | With keycode definition, may help: http://g.slyip.com/_scripts/file.php?f=2699&r=2330 | Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|