title image


Smiley Re: Anwendung offen ? Anwendung geschlossen ???
Hallo,Ihrgend ein Teil des Klassennamens ist immer derselbe.Den mußt Du mit like "*Text*" abfragen:'---Posted by Dev Ashish---''(Q) How do I find out the Class Name of a running application?''(A) Paste the following code in a new module and then run the function' fEnumWindows from the Debug window. The function will print out the Class' Name and Caption of all running applications that are currently visible.'************** Code Start ***************'Code Courtesy of'Dev AshishPrivate Declare Function apiGetClassName Lib "user32" Alias _ "GetClassNameA" (ByVal hwnd As Long, _ ByVal lpClassName As String, _ ByVal nMaxCount As Long) As LongPrivate Declare Function apiGetDesktopWindow Lib "user32" Alias _ "GetDesktopWindow" () As LongPrivate Declare Function apiGetWindow Lib "user32" Alias _ "GetWindow" (ByVal hwnd As Long, _ ByVal wCmd As Long) As LongPrivate Declare Function apiGetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hwnd As Long, ByVal _ nIndex As Long) As LongPrivate Declare Function apiGetWindowText Lib "user32" Alias _ "GetWindowTextA" (ByVal hwnd As Long, ByVal _ lpString As String, ByVal aint As Long) As LongPrivate Const mcGWCHILD = 5Private Const mcGWHWNDNEXT = 2Private Const mcGWLSTYLE = (-16)Private Const mcWSVISIBLE = &H10000000Private Const mconMAXLEN = 255Function fEnumWindows()Dim lngx As Long, lngLen As LongDim lngStyle As Long, strCaption As String lngx = apiGetDesktopWindow() 'Return the first child to Desktop lngx = apiGetWindow(lngx, mcGWCHILD) Do While Not lngx = 0 strCaption = fGetCaption(lngx) If Len(strCaption) > 0 Then lngStyle = apiGetWindowLong(lngx, mcGWLSTYLE) 'enum visible windows only If lngStyle And mcWSVISIBLE Then Debug.Print "Class = " & fGetClassName(lngx), Debug.Print "Caption = " & fGetCaption(lngx) End If End If lngx = apiGetWindow(lngx, mcGWHWNDNEXT) LoopEnd FunctionPrivate Function fGetClassName(hwnd As Long) Dim strBuffer As String Dim intCount As Integer strBuffer = String$(mconMAXLEN - 1, 0) intCount = apiGetClassName(hwnd, strBuffer, mconMAXLEN) If intCount > 0 Then fGetClassName = Left$(strBuffer, intCount) End IfEnd FunctionPrivate Function fGetCaption(hwnd As Long) Dim strBuffer As String Dim intCount As Integer strBuffer = String$(mconMAXLEN - 1, 0) intCount = apiGetWindowText(hwnd, strBuffer, mconMAXLEN) If intCount > 0 Then fGetCaption = Left$(strBuffer, intCount) End IfEnd Function'************** Code End ***************Walter

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: