Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ShowWindow problem
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
ShowWindow problem
Miscellaneous
Thread ID:
00307566
Message ID:
00307566
Views:
36
Below is code for a function (based on examples posted here) that gets an active Window in my VFP6 application and brings it to the front and shows the form. I'm having problems with controls being partly painted.

Is there something I'm missing?


LPARAMETERS tWindowName
#DEFINE GW_OWNER 4
#DEFINE GW_HWNDFIRST 0
#DEFINE GW_HWNDNEXT 2
DECLARE INTEGER ShowWindow IN WIN32API Integer, Integer
DECLARE INTEGER SetForegroundWindow IN win32api LONG lnhWnd
DECLARE INTEGER GetWindowText IN win32api INTEGER, STRING, INTEGER
DECLARE INTEGER GetWindow IN win32api INTEGER,INTEGER
DECLARE INTEGER IsWindowVisible IN win32api INTEGER
DECLARE INTEGER GetActiveWindow IN win32api
DECLARE INTEGER BringWindowToTop IN WIN32API LONG
lsWindEx = .F.
IF LEN(tWindowName) < 1
RETURN .t.
ENDIF
lFoxhwnd = GetActiveWindow() && get the window handle of this window
lHwndNext = GetWindow(lFoxhwnd,GW_HWNDFIRST) && get the handle of the first window

**** loop thru each window to search the title
DO WHILE lHwndNext <> 0
lStuffer = SPACE(64)
GetWindowText(lHwndNext,@lStuffer,64) && get the window text
*** check to see if this is the specified window.
IF tWindowName $ lStuffer
lsWindEx = .T.
=BringWindowToTop(lHwndNext)
=ShowWindow(lHwndNext, 2)
=ShowWindow(lHwndNext, 1)
=SetForegroundWindow(lHwndNext) && BRING WINDOW TO FRONT
EXIT
ENDIF
lHwndNext = GetWindow(lHwndNext,GW_HwndNext)
ENDDO
RETURN lsWindEx


Thanks
Jack Tumlin
Next
Reply
Map
View

Click here to load this message in the networking platform