Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bringing Excel window forward
Message
De
07/11/2019 13:01:14
 
 
À
07/11/2019 10:24:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01671640
Message ID:
01671814
Vues:
71
>Hi Naomi,
>That worked. So for a summary to anyone else reading this thread, this is what worked:
>Word:
>.ioServer.Application.WindowState = 2 && i.e. minimized; note: maximized is 1 if needed
>.ioServer.Application.WindowState = 0 && i.e. normal
>* where .ioServer is the Word object

This also works with Word, and without flickering the window. It is the method suggested on an MSDN discussion where someone asked how to access Word's HWND. You need to have the root Word.Application object, however, as in "lo" below.

You can verify this by copying-and-pasting this code into VFP9 in a test.prg and single-stepping through it:
lo = CREATEOBJECT("word.application")
lo.Visible = .t.

DECLARE INTEGER FindWindow IN WIN32API STRING cClass, STRING cName
lcOldCaption = lo.Caption
lcNewCaption = SYS(2023) + "Changed to something unique momentarily to find only me"
lo.Caption = lcNewCaption
lnHwnd = FindWindow(NULL, lcNewCaption)
lo.Caption = lcNewCaption

* Use lnHwnd like normal in the Excel example below:
DECLARE INTEGER BringWindowToTop IN WIN32API INTEGER hWnd
DECLARE INTEGER ShowWindow IN WIN32API INTEGER hWnd, LONG nCmdShow
ShowWindow(lnHwnd,1)
BringWindowToTop(lnHwnd)
>Excel:
>* this one uses Win32 functions to bring the window forward
>DECLARE INTEGER BringWindowToTop IN WIN32API INTEGER hWnd
>DECLARE INTEGER ShowWindow IN WIN32API INTEGER hWnd, LONG nCmdShow
>ShowWindow(.ioServer.HWnd,1)
>BringWindowToTop(.ioServer.HWnd)
>* where .ioServer is the Excel object
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform