I don't know why this code doesn't work ...



invoke SendMessage, handle, WM_KEYDOWN, VK_SPACE,2


while, this code works ....



invoke SendMessage, handle, WM_CHAR, VK_SPACE,2


handle is the handle of edit window ....

Actually, primarily what I want to do is that send keydown message of space bar for given time... such as 5 secs or 10 secs ....

And how can I set "lParam" data of "WM_KEYDOWN" .... can I just do just like:



invoke SendMessage, handle, WM_KEYDOWN, wParam, somenumber?




lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value Description
0-15 Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key.
16-23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25-28 Reserved; do not use.
29 Specifies the context code. The value is always 0 for a WM_KEYDOWN message.
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 Specifies the transition state. The value is always 0 for a WM_KEYDOWN message.


I could find these from help file, but I am not sure how to set these values or how
to combine them.

Thanks :grin:
Posted on 2003-03-17 14:05:43 by Gandalf
When you SendMessage, the (control) window procedure gets directly invoked. This means that the TranslateMessage routine (which uses WM_KEYDOWN and WM_KEYUP to generate WM_CHAR messages) is not invoked. The EDIT control expects most, if not all, of its keyboard input to be WM_CHAR messages.
Posted on 2003-03-17 14:35:09 by tenkey
Good info. Then else we may use PostMessage while WM_KEYDOWN is it? If so which one and when we needs?
Posted on 2003-03-17 18:44:04 by cakmak