


Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetParent& Lib "user32" (ByVal hWnd As Long)
Public Declare Function IsWindowVisible& Lib "user32" (ByVal hWnd As Long)
Public Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
Public Const GW_HWNDNEXT = 2
Public Const GW_Child = 5
Dim sPattern As String
Dim hFind As Long
Public Function FindWindowWild(sWild As String, Optional bMatchCase As Boolean = True) As Long
sPattern = sWild
If Not bMatchCase Then sPattern = UCase(sPattern)
EnumWindows AddressOf EnumWinProc, bMatchCase
FindWindowWild = hFind
End Function
Function EnumWinProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
Dim k As Long
Dim sName As String
If IsWindowVisible(hWnd) And GetParent(hWnd) = 0 Then
sName = Space$(128)
k = GetWindowText(hWnd, sName, 128)
If k > 0 Then
sName = Left$(sName, k)
If lParam = 0 Then sName = UCase(sName)
If sName Like sPattern Then
hFind = hWnd
EnumWinProc = 0
Exit Function
End If
End If
End If
EnumWinProc = 1
End Function
Yourbanwindow = FindWindowWild("*Text on ban window", False)x = FindWindowWild("*Voice Room", False)

Snoopy1968 wrote:This is probley a simply quesiton
but how do you tell visual basic you want the Yes with the special character under the "Y"
?





SendMessage is ~synchronous~. Consider the
case where the recipient process is hung or in a "not-responding"
state. The sending process then effectively becomes hung as well
because it's waiting indefinitely for a response which may never come.
The sending process needs a way to either ignore that condition or
detect it. PostMessage is asynchronous (does not wait for a response)
so you could use it if you wanted to simply ignore a non-responsive
state. However you cannot use PostMessage if you're passing strings or
any other type of pointer in one of the args. SendMessageTimeout is
synchronous (like SendMessage) except you can supply a timeout value.
It's useful when you need to wait for a response or know the message
was processed, but provides a means to avoid a wait forever condition.
It also allows you to use string or pointer args.
It's also important to make sure the recipient can process the
messages in a timely fashion. For example if it has intensive
processing routines that take more than a second or so to complete, it
should be calling DoEvents occasionally to process any pending
messages on its queue.




Users browsing this forum: No registered users and 0 guests