title: FindWindow() not working
body: <p>I am writing a Little VBA Programm that Needs to wait until a specific windows is open. I want to do this using FindFindow form the user32.dll but i cant get it run. Weird Thing is that even if i set the 2 Parameters of the function to Null, i still get a negative return, although in that case all windows should match. Basically i dont get a result different from 0 for hwnd Independent of how i call FindWindow. I searched Stack OPverflow and i also Googled the Problem but i cant find what i am doing wrong. Any help is appreciated.</p>
  
  <pre><code>Declare Function FindWindow Lib "user32" _
  (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  Sub Main
      Dim hwnd As Long
  
      hwnd = FindWindow(vbNullString, vbNullString)
  
      If (hwnd = 0) Then MsgBox ("failure")
  
  End Sub
  </code></pre>
  
  <p>The Solutions to similar Problems like <a href="https://stackoverflow.com/questions/25098263/how-to-use-findwindow-to-find-a-visible-or-invisible-window-with-a-partial-Name">How to use FindWindow to find a visible or invisible window with a partial name in VBA</a> dont seem to work either.</p>