Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Application not in focus on startup
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00864735
Message ID:
00865022
Views:
26
>Windows 2000 Professional

I had a similar problem after I first installed Windows 2000 and ran my VFP apps.

I found this code that fixes the problem.
PROCEDURE BringAppToTop
LPARAMETERS tcAppName

*** Brings the app to the top and give it focus in Windows 2000
DECLARE INTEGER FindWindow IN Win32API STRING, STRING
DECLARE SHORT SetWindowPos IN USER32 ;
	   INTEGER hWnd, ;
	   INTEGER hWndInsertAfter, ;
	   INTEGER x, ;
	   INTEGER y, ;
	   INTEGER cx, ;
	   INTEGER cy, ;
	   INTEGER uFlags
#DEFINE HWND_TOPMOST_WINDOW -1
#DEFINE SWP_NOMOVE 2
#DEFINE SWP_NOSIZE 1
#DEFINE SWP_SHOWWINDOW 0x40
#DEFINE SWP_BRINGTOTOP SWP_NOSIZE + SWP_NOMOVE + SWP_SHOWWINDOW
hWnd = FindWindow(0, tcAppName)
=SetWindowPos(hWnd, HWND_TOPMOST_WINDOW, 0,0,0,0, SWP_BRINGTOTOP) 
_SCREEN.AlwaysOnTop = .T.
_SCREEN.AutoCenter = .T.
_SCREEN.Visible = .T.
_SCREEN.Show()
_SCREEN.AlwaysOnTop = .F.
RETURN
Call it with this code.
*** Bring app to top in Windows 2000
    BringAppToTop(_SCREEN.Caption)
Hope this works for you.
Dennis Lindeman
Previous
Reply
Map
View

Click here to load this message in the networking platform