The following example calls the FindWindow to determine if Program Manager is running.
This example uses the Any keyword to pass a NULL pointer, which is accepted by the FindWindow function.
Declare Function FindWindow16 Lib "user" Alias "FindWindow" (ByVal Class _
As Any,ByVal Title As Any) As Integer
Declare Function FindWindow32 Lib "user32" Alias "FindWindowA" (ByVal Class _
As Any,ByVal Title As Any) As Long
Sub Main()
Dim hWnd As Variant
If Basic.Os = ebWin16 Then
hWnd = FindWindow 16("PROGMAN",0&)
ElseIf Basic.Os = ebWin32 Then
hWnd = FindWindow32("PROGMAN",0&)
Else
hWnd = 0
End If
If hWnd <> 0 Then
MsgBox "Program manager is running, window handle is " & hWnd
End If
End Sub
|