| Re: SendMessage - Tab not working, well kinda not |
|
 |
|
 |
|
 |
|
 |
Group: borland.public.delphi.vcl.components.using.win32 · Group Profile
Author: Peter Below (TeamB)Peter Below (TeamB) Date: May 22, 2008 00:46
Peter Below (TeamB) wrote:
>> What should I be sending here to force the waiting app to move focus
>> to the next input field?
>
> You could try to send a WM_NEXTDLGCTL message, but not to the focused
> control. This message needs to be send to the top-level window that
> owns the control. But as Remy said the navigation is the task of the
> top level window (form in a VCL app) and it may not respond to the
> message above as a VCL form or API dialog would.
>>
>> I have checked the API help but cannot seem to work out how to do
>> this. I looked at WM_SYSCHAR but that appears to be used in
>> conjunction with the Alt key.
>
> Well, you could try a
>
> lparam := MakeLong(0, MapVirtualKey(VK_TAB, 0) or $20000000); //
> lparam: Longint;
> SendMessage(hFocusWin,WM_SYSCHAR,9,lparam);
>
> But this would only work if the receiving application does not
> actually check the state of the ALT key but relies on the
> bit in lparam set by the code above.
I need more sleep . Alt-Tab is not the correct key combination to
switch controls inside a window, you need Ctrl-Tab for that and that
cannot be faked via a WM_CHAR/WM_SYSCHAR message. The PostKeyEx method
may be able to do it, though.
|