Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bringing another application window to top. Any help?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00099111
Message ID:
00099369
Views:
26
>>>>How can i bring the Microsoft excel window (ie) to top from vfp?
>>>
>>>Carlos,
>>>
>>>You can use the Is_Run32 function (available in the download section under Win32 and other APISs), to retrieve the window for Execl by passing it the known portion of the title bar (ie - "Microsoft Excel"). Then you can use the following:
>>>DECLARE SHORT BringWindowToTop IN Win32API;
>>> INTEGER hWnd
>>>* lnhWnd is the value returned from Is_Run32
>>>llresult = (BringWindowToTop(lnhWnd) # 0)
>>>If the function succeeds, llresult will equal .T.
>>>
>>>hth,
>>
>>But, if the window for Excel was minimized you need to use the ShowWindow function to restore it.
>>...
>>#define SW_RESTORE 9
>>declare SHORT ShowWindow in wi32api INTEGER hWnd, INTEGER nCmdShow
>>ShowWindow( lnhWnd, SW_RESTORE)
>>...
>>
>>Alexander Grigorjev
>
>Alexander,
>
>Actually both are needed, since if the window isn't an icon, ShowWindow() won't bring it to the top of the Z order. So...
>DECLARE SHORT IsIconic IN Win32API;
>  INTEGER hWnd
>llresult = (IsIconic(lnhWnd) # 0)
>IF llresult
>  = ShowWindow(lnhWnd, SW_RESTORE)
>ENDIF
>= BringWindowToTop(lnhWnd)
>Solves both problems.

Yes, of course, George. I has missed the word "else" after "minimized".
I has continued written by you.

Alexander
Alex
Previous
Reply
Map
View

Click here to load this message in the networking platform