Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Execl & win32API GetForgroundWindow
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Execl & win32API GetForgroundWindow
Divers
Thread ID:
00365075
Message ID:
00365075
Vues:
106
I am creating an object for Excel using Automation and am trying to determine when the user close/quits excel.

I have it working for Word but I am having problems getting it working for Excel. Below is what works for Word.

* --- Define WinApi Functions
DECLARE integer GetForegroundWindow in WIN32API
DECLARE short IsWindow in WIN32API integer
oWord = CreateObject("Word.Application")
oWord.Visible = .T.
oWord.Activate()
lnWordWindow = GetForegroundWindow() && Save word window handle

If Type("oWord") = "O" And Not IsNull(oWord)
&& Loop while Word Window Active
Do While IsWindow(lnWordWindow) # 0
EndDo
&& User has Closed Word Session

Release oWord
Release oDocument
EndIf

Thanks for the help

Here is what I am trying for Excel.


DECLARE integer GetForegroundWindow in WIN32API
DECLARE short IsWindow in WIN32API integer

oExcel = CreateObject("Excel.Application")
oExcel.Visible = .T.
lnExcelWindow = GetForegroundWindow() && Save excel window handle

If Type("oExcel") = "O" And Not IsNull(oExcel)
Do While IsWindow(lnExcelWindow) # 0
EndDo
Release oExcel
EndIf
Eddie McCandless
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform