Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set a window active?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00344057
Message ID:
00344121
Views:
23
>I'm using API for the firste time today. I've managed to make a code that checks if a spesific window is open (a delphi window), if it isn't open I open it - but if it is open I would like to make that window active in front.
>
>Can anyone help me?
>
>
Hi Kenneth,

The following takes into consideration whether or not the other window is minimize.
#DEFINE SW_RESTORE 9
DECLARE INTEGER ShowWindow IN Win32API;
INTEGER hwnd, INTEGER nCmdShow
DECLARE SHORT IsIconic IN Win32API;
 INTEGER hwnd
DECLARE SHORT SetForegroundWindow IN Win32API;
 INTEGER hWnd
* lnhWnd is the Window handle of interest
llicon = (IsIconic(lnhWnd) # 0)
= SetForegroundWindow(lnhWnd)
IF llicon
  * It's an icon, so restore it
  = ShowWindow(lnhWnd, SW_RESTORE)
ENDIF
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform