Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a better kludge for SetForegroundWindow?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00671245
Message ID:
00671802
Views:
20
Hi Larry,

Thanks for the suggestion. As I replied to Alexander, I have not tried SystemParametersInfo, but it may be worth investigating further. The documentation on this is very confusing and seems to indicate several drawbacks, as well as raising doubts about its suitability as a general remedy. I'm not sure how much more time I want spend on this, so for the time being I'll settle for the ShowWindow MINIMIZE/RESTORE kludge until a clearly superior alternative presents itself.

Mike

>Mike,
>Check out the MSDN topic for SetForegroundWindow here: http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setforegroundwindow.asp.
>
>It shows a caveat for 2000/XP users. Depending on your environment, you might be able to use the SystemParametersInfo function to correct the situation.
>
>HTH.
>
>>>Check this
>>>
>>>
>>>set library to (home()+'foxtools.fll')  && for use of MainHwnd()
>>>myhwnd = MainHwnd()                     && obtain HWND for VFP main window
>>>run /n explorer.exe /e,/select,c:\      && launch Explorer against c:\
>>>
>>>* pause long enough for the Explorer window to open
>>>DECLARE Sleep IN kernel32 INTEGER dwMilliseconds
>>>sleep(500)
>>>
>>>_Screen.AlwaysOnTop = .t.
>>>_Screen.AlwaysOnTop = .f.
>>>_screen.Draw
>>>DECLARE INTEGER SetForegroundWindow IN user32 INTEGER hwnd
>>>? SetForegroundWindow(m.myhwnd)         && try to bring VFP back to foreground
>>>
>>>
>>>HTH
>>
>>Hi Zlatin,
>>
>>Thanks for giving it a try. I tested your suggestion in both VFP6 and VFP7 under Win2KPro SP1, but it doesn't work. The VFP window is brought to the foreground, however it is not activated and it doesn't get the focus, just the flashing taskbar button. This is not equivalent to the ShowWindow MINIMIZE/RESTORE results. Did you test under Win2K? I think there may also be similar issues under Windows 98, but I haven't tested that.
>>
>>Mike
Montage

"Free at last..."
Previous
Reply
Map
View

Click here to load this message in the networking platform