Reputation: 11389
I want to close a certain window.
Spy++ tells me that the window is of class name "ad_win#2":
However, when I use FindWindow like that...
Public Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Dim lRet&
lRet = FindWindow("ad_win#2", vbNullString)
.... lRet is 0, meaning that it didn't find any window.
What am I doing wrong?
Thank you!
Upvotes: 3
Views: 2376
Reputation: 11389
It works when I add a ChrW(10) to the name like this:
Dim lRet&
lRet = FindWindow("ad_win#2" & ChrW(10), vbNullString)
Upvotes: 3