Okay -
Right off the bat I would suggest that the _SCREEN caption for each VFP window be assigned a unique name. Then use the findwindow function and the caption of the window you want to activate to isolate that window's hWnd. Then fire your hWnd activators.
declare integer FindWindow in win32api integer nullpointer, string cwindow_name
The PITA would be designating the screen names for each VFP window.
>Hi Terry
>Maybe I explain wrong.. but I don't understand solution sorry
>
>For example:
>I run VFP twice
>First one I minimize (but I know _screen.hwnd)
>In second VFP command window I type ShowWindow(lnFirstVFPHwnd,3)
>SetForegroundWindow(lnFirstVFPHwnd)
>Then... first VFP blinking in windows.. but stay minimized and have not focus.
>Should I place a textbox on screen to get it work? or?
>
>Thanks
>
>
>
>>You migh try making the form name public so it can be referenced from anywhere in your project.
>>
>>Sometimes adding a "hidden", but not disabled, textboxes to forms (you can hide them behind some other control). When the project needs to activate a form that does not have focus, a click event is forwarded to the control - which usually activates it's parent form.
>>
>>Setting focus to the hidden textbox (or a hidden button) and issuing a KEYBOARD command is anther method to fire the parents activate event.
>>
>>>Hi,
>>>I use Winsock control. when my application got message from remote computer - the main window must appears in Windows as foreground window (like ALT-TAB switch)
>>>
>>>SwitchToThisWindow(_screen.HWnd,1)
>>>SetForegroundWindow(_screen.HWnd)
>>>SetFocusAPI(_screen.HWnd)
>>>
>>>Not help for me ;(
>>>
>>>Any idea
>>>Thanks
>>>Denis
Imagination is more important than knowledge