Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Screen bitmap dissapears when using api calls
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00435088
Message ID:
00438563
Views:
8
The SetForegroundWindow() acts differently when used in Windows 95, Windows 98, Windows NT or Windows 2000!!!

Windows 98, Windows 2000: The system restricts which processes can set the foreground window. A process can set the foreground window only if one of the following conditions is true:

1) The process is the foreground process.
2) The process was started by the foreground process.
3) The process received the last input event.
4) There is no foreground process.
5) The foreground process is being debugged.
6) The foreground is not locked (see LockSetForegroundWindow).
7) The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo).
8) Windows 2000: No menus are active.

An application cannot force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window and call the FlashWindowEx function to notify the user.

A process that can set the foreground window can enable another process to set the foreground window by calling the AllowSetForegroundWindow function.

The foreground process can disable calls to SetForegroundWindow by calling the LockSetForegroundWindow function.

On top of this, it seems (I cannot guarantee it's alwayts the case), that VFP automatically creates 4 child windows of _SCREEN. It seems that there is one window dedicated to the menu, one for the status bar (if any) and one for the working area (client area) (in all my tests this is always the 3rd one!). The 4rth one? I have no idea!

The 3rd one is the one where your bitmap is displayed (_SCREEN.picture). You should enumerate all chil windows and try to give it the focus.

You can try the following functions of the Win32 API, one by one, or combined:

SetForegroundWindow()
SetActiveWindow()
BringWindowToTop() (very good guess)
SetFocus()
SetWindowPos()
ShowWindow()

Good luck,

Pat

>Ed,
>
>It's not in an ActiveX control. It is set in the main executable with the following line.
>
>_screen.picture = "bmps\mainscreen.bmp"
>
>regards,
>
>JE
>
>>>lnhWnd = is_run32("'Application title'")
>>>if lnhWnd != 0 then
>>> declare integer ShowWindow in WIN32API integer, integer
>>> #define SW_RESTORE 9
>>> ShowWindow( lnHWND, SW_RESTORE )
>>> DECLARE INTEGER SetForegroundWindow IN WIN32API INTEGER
>>> setforegroundwindow(lnhWnd)
>>> quit
>>>endif
>>>
>>>
>>>Is there some kind of api call I can do to make sure that the screen bitmap shows as viaible when the above code is run?
>>>
>>
>>Is the bitmap displayed in an ActiveX control? If so, it's actually a child Window of the Form's hWnd, and you'd have to do something (like maybe call the control's Refresh() method) to force it to the top of the ZOrder relative to the Form, which acts as it's immediate parent.
Previous
Reply
Map
View

Click here to load this message in the networking platform