Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Findwindow API problem ?
Message
De
11/11/1998 10:56:50
 
 
À
10/11/1998 09:22:22
Rob Gordon
Xon Digital Communications Ltd.
Dartmouth, Nouvelle-Écosse, Canada
Information générale
Forum:
Visual Basic
Catégorie:
Contrôles ActiveX
Divers
Thread ID:
00155549
Message ID:
00156598
Vues:
34
>>>>>I need the Win32 API that do the similar things as Findwindow
>>>>>in WIN NT-4 ?
>>>>
>>>>The FindWindow() API call works the same in both Win9x and WinNT.
>>>
>>>Sorry to intrude , but I'm having a problem getting this function to work at all (in Win95).
>>>
>>>EG> Declaration
>>>
>>>Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
>>>
>>>dim MyAppWindowName as string
>>>MyAppWindowName="MyApp Window Title"
>>>MyHandle=FindWindow(0,MyAppWindowName)

Your error is here; instead of 0, pass a null string, as in:

MyHandle = FindWindow(vbNullString,"MyApp Window Title")


>>>
>>>This never works .. although it works fine in VFP
>>
>>except that in VFP, strings are always passed by reference, and if you look at the API declaration in the MSDN documentation, you'll find that the parameters passed are both LPCTSTRs, pointers to CStrings. Thus, they are passed ByRef not ByVal.
>>
>>>
>
>I tried changing the declaration to ByRef rather than ByVall .. still no luck .. Im trying to check for another program running. Could you give me an example of code that works ? Much appreciated ...
>
>
>>>I have also tried ..
>>>MyHandle=FindWindow("",MyAppWindowName)
>>>
>>>or ..
>>>MyAppWindowName="MyApp Window Title"+chr$(0)
>>>MyHandle=FindWindow(0,MyAppWindowName)
>>>
>>>etc etc .. never any luck .. the window DOES exist .
>>>
>>>HELP !
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform