Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FindWindow() VFP from Word
Message
De
23/09/1998 08:55:58
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00139394
Message ID:
00139765
Vues:
89
>>Klas,
>>George is right. FindWindow gets 2 parameters, class and title. If any of the parameters you pass null, everything matches :
>>
>>FindWindow(Class,Title) && Check both match
>>FindWindow(0,Title) && Any class match
>>FindWindow(Class,0) && Any title match
>>FindWindow(0,0) && Any class and title match
>>
* Fox code
>>function fWin
>>lParameters tuClass, tuWinTitle
>>DECLARE integer FindWindow in WIN32API string cClass, string cWinName
>>hWnd = FindWindow(tuClass,tuWintitle)
>>clear dlls
>>return hWNd
>>
>>? fwin("Fox_4000001","Microsoft Visual FoxPro") && 824
>>? fwin("Fox_4000001",0)                         && 832
>>? fwin(0,"Microsoft Visual FoxPro")             && 824
>>? fwin(0,0)                                     && 904
>>
>>Here interesting thing with only one instance of VFP (development), fwin("Fox_4000001",0) and fwin(0,"Microsoft Visual FoxPro") return different values (where is the main fox window ?). And many VFP window with same title return only first.
>>
>>I would also test it for you in word if I knew how to write and test that in word.
>Hi Cetin,
>
>I cannot emphasize enough that it's a terrible idea to use window class names when trying to use FindWindow(). As I mentioned, without something like Spy++, it can be very difficult to accurately determine what's what. Further, the above samples will fail if the class name is passed and the version of VFP that's running is 6.0. The main window class name for that version is VFP66400000.
>
>Whenever VFP is started there are no fewer than 10 windows associated with it. One these, BTW, has a class name different from either of the two mentioned above, and different between versions.

Hidy George,
Agree :) There is one place I use classname though. Here is the scenario :
-Invoke word
-Immediately get its class from known title at that point
-Wait till word finishes checking by class (title might have changed)
Here I do :
* tcWaitWindowClass is saved from FindWindow(0,title)
* and GetClassName()
do while this.findwindowhandle(tcWaitWindowClass)<>0
enddo
release oWordDocument

*Findwindowhandle
lparameter tcWinClass
DECLARE integer FindWindow in WIN32API string cNull, string cWinName
nHWND = FindWindow(tcWinClass,0)
clear dlls
return nHWND
Being frankly I wouldn't do it this way if I coded it now. I'm dealing only with the one I invoked and this works (might it not :( ?). I didn't yet try isrun32 instead yet.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform