Is it possible to find a window without supplying the WindowName in DNS Advanced Scripting

48 Views Asked by At

I am trying to find a specific window-class and want to send a custom message to it via a DNS command. I have trouble locating the window.

This is a working example for Notepad:

Declare Function FindWindow Lib "USER32" _
(ByVal lpszClassName As String, ByVal lpszWindow As String) As Long

Sub Main
    Dim hWnd As Long
    hWnd = FindWindow("Notepad", "Unbenannt - Editor") '<-- german title; change it
    Debug.Print CStr(hWnd)
End Sub

However, It will not find the handle if I use the following:

hWnd = FindWindow("Notepad", vbNullString)

And I think it should. Here is the MSDN-Entry for it. It states, that the window name is optionally. Am I missing something?

I think that getting the window name is not an option in my case, as the target is an rich-edit-control which will not have a static window name as it send it's content rather than a static title (which is standard behavior). So I need to get this to work wthout supplying a window name.

0

There are 0 best solutions below