Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Focus to Top Level Form
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00546077
Message ID:
00546115
Views:
23
This message has been marked as the solution to the initial question of the thread.
Hi!

DECLARE INTEGER FindWindow IN Win32API;
string lpClassName, STRING lpWindowName

and do not use '@' for second parameter. When you declare it the way you described, the reference to '0' will be used that is really is not a zero value (null pointer) ;) In addition, VFP passes strings by reference anyway. At least I use after such declaration ? FindWindow(0,_Screen.Caption) and it returns non-zero value. Note that in W2K it could return negative numbers, so just check for zero.

>Guess I could do with VFP7! I just can't get it to detect the window! Here is the code - I wondered if you could see any problems with it?
>
>DECLARE INTEGER FindWindow IN Win32API;
>STRING @lpClassName, ;
>STRING @lpWindowName
>
>lcApplicationTitle = (oApp.AppTitle + oApp.FormCaption)
>*!* wait window "Caption " + (lcApplicationTitle)
>lnHWnd = FindWindow(0, @lcApplicationTitle)
>
>*!* wait window "Handle " + str(lnHWnd)
>
>DECLARE SHORT SetForegroundWindow IN USER32.DLL INTEGER lnHWnd
>* I assume you've got the hWnd you want stored in the variable nhWnd
>IF SetForegroundWindow(lnHWnd) # 0
> * the desired window and thread are now in the foreground
>wait window "Success"
>ELSE
>wait window "Failed"
> * the hWnd was not assigned to the foreground and the thread
> * remains at its default priority
>ENDIF
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform