|
-
Sep 25th, 2000, 08:56 AM
#1
Thread Starter
Junior Member
Hi,
I want to get a window handle with the FindWindow api, but the function always returns 0.
This is my code :
Private Sub Command1_Click()
Dim WindowHwnd as Long
WindowHwnd = FindWindow("#32770 (Dialog)", CLng(0)) ' it's the ie download window class name
If WindowHwnd = 0 Then
Label1.Caption = "Il n'y a pas de D/L en cours"
Else
Label1.Caption = "Il y a un D/L en cours"
End If
End Sub
Thanks
-
Sep 25th, 2000, 09:41 AM
#2
Fanatic Member
FindWindow will not search through child windows, use FindWindowEx.
The code below will find the "File Download" Window and close it.
Private Declare Function FindWindowEx Lib "User32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10
Private Sub Command1_Click()
Dim bWnd, i
bWnd = FindWindowEx(ByVal 0&, ByVal 0&, vbNullString, "File Download")
If bWnd = 0 Then
Label1.Caption = "NO"
Else
Label1.Caption = "YES"
i = SendMessage(bWnd, WM_CLOSE, 0, 0&)
End If
End Sub
Bon Chance.
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Sep 25th, 2000, 09:54 AM
#3
Thread Starter
Junior Member
-
Sep 25th, 2000, 03:13 PM
#4
I assume you used Spy++ to get the ClassName. The class name for a dialog is not #32770 (Dialog), rather it's just #32770.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|