Yeah, I tried that, but it doesn't work. Here's what the code looked like:
nhWnd = FindWindow( 0, _chrWindowName )
?"nhWnd = " + ALLTRIM(STR(nhWnd))
DECLARE INTEGER GetLastError;
IN WIN32API
DECLARE SHORT SetForegroundWindow IN USER32.DLL INTEGER hWnd
nResult = SetForegroundWindow(nhWnd)
IF nResult # 0
?"Success"
ELSE
?"nResult = 0"
nError = GetLastError()
?"Error code: " + STR(nError)
ENDIF
I get:
nhWnd = 7195
nResult = 0
Error code: 2
I looked error code 2 up on MSDN and see that it means "file not found." Freaky. Is this an issue in VFP 6.0 vs. 2000 as well?
Marty
>>I've got a situation that's driving me nuts! VFP 5.0
>>
>>I have a 2-As Top Level Form that works great in Windows 98, but has gone nuts in Windows 2000. When I start the application, it fires up the form
behind any explorer windows which are open. I've tried everything!
>>
>>The only thing I've found that works, is removing SCREEN=OFF from CONFIG.FPW. I put an Application.Visible = .F. in the main program, and everything works fine. Problem is, it does that ugly "flash" of the VFP screen.
>>
>>I can't be the only person who's experienced this. I saw Ed Rauh's solution using WindowPos API call, but that doesn't fix it either.
>
>Try the SetForeGroundWindow API function. It's in the WinAPI section.
>
>HTH.
Marty Smith, CSQE