Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bringing Excel window forward
Message
De
23/10/2019 17:39:11
 
 
À
23/10/2019 14:45:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01671640
Message ID:
01671651
Vues:
55
Hi Rick,

Yes, just tried and I was trying to query the wrong object - my loExcel object is actually a wrapper around the actual Excel applilcation itself. So once I got that figured out, I could get hwnd e.g. loExcel.ioServer.hwnd (this is how it is constructed in the VFP Office automation book).

Will test it on Friday when I get back to my desk. Should help!

Albert

>>Hi Rick,
>>How do I get an hwnd handle to an Excel object? I got an error loWorkbook.HWnd. Do I have to do another function call to get the handle from the OS?
>
>The example I included in my OP worked for me from the command prompt. Make sure you're using the root Excel.Application object, and not an object reference from something deeper. You may also be able to reference it contextually from a lower object using loWorkbook.parent.parent.HWnd or something along those lines. Never tried it.
>
>>>>Hi,
>>>>
>>>>Can someone post code as to how to bring an Excel window forward using api calls? My current code creates an Excel document, inserts all the data and then uses .Activate() which just activates it on the toolbar so that it is flashing - it does not actually bring it forward. I figure Win api calls would need to be used to do this.
>>>>
>>>>I have looked in the VFP Office automation book but the constants used are old and figure someone might have a nice function to do this.
>>>
>>>
lo = CREATEOBJECT("Excel.Application")
>>>lo.visible = .t.
>>>
>>>DECLARE INTEGER BringWindowToTop IN WIN32API INTEGER hWnd
>>>DECLARE INTEGER ShowWindow       IN WIN32API INTEGER hWnd, LONG nCmdShow
>>>
>>>ShowWindow(lo.HWnd, 1)
>>>BringWindowToTop(lo.HWnd)
>>>
>>>Works with any window you can get an HWnd to (thisForm, _screen, etc.).
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform