Activating an application and correctly setting the focus
Posted on 2007-11-14
I've a series of applications which can be used concurrently. The user can switch between the applications without alt-tabbing, from within each application.
This works fine, but...
If application A switches to application B, and application B has a modal dialog open, it's the main form which is shown - not the modal dialog. The user then clicks on the main form and of course nothing happens other than a series of beeps. The user has to alt tab to bring the modal dialog into view and then close this to allow access to the application.
How can I achieve the same result as alt-tabbing? This is how I'm doing it at the moment...
Result := FindWindow(Pchar(ThisWindowClass), nil);
SendMessage(Result, WM_ACTIVATEAPP, 1, 0);
Thanks for any help.