Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WIN2000 & VFP main screen
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00468282
Message ID:
00468406
Views:
24
This is a new feature on Win2000. Apps do not automatically get focus when they start. I have added the following to my apps that need to run on Win2000.

*********************** In start up code
app_title = 'My Great App'
lcSaveCaption = _SCREEN.Caption
_SCREEN.Caption = app_title

DO BringToTop WITH app_title


********************************************************
PROCEDURE BringToTop
PARAMETERS tcAppName

*** The following code is required to bring 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
Dennis Lindeman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform