FindWindow can only find those windows that have window text (Captions) that
match your search string. You would be better off using EnumWindows to
search for internet explorer By using EnumWindows, you can search for the
words "Internet Explorer" anywhere in the window text..
Mike Ober.
"Husam" <(E-Mail Removed)> wrote in message
news:1724F2E2-CCBE-427A-9C62-(E-Mail Removed)...
> Hi EveryBody:
>
> I have the following code which just helpfull with Notepad:
>
> Code:
> <DllImport("user32", CharSet:=CharSet.Auto, SetLastError:=True)> _
> Public Shared Function FindWindow(ByVal lpClassName As String, ByVal
> lpWindowName As String) As Integer
> '
> End Function
> <DllImport("user32", CharSet:=CharSet.Auto, SetLastError:=True)> _
> Public Shared Function SendMessage(ByVal hwnd As Int32, ByVal wMsg
As
> Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
> '
> End Function
> Private Const WM_CLOSE = &H10
>
> Under button I put:
>
> Dim intHandle As Integer = FindWindow("Notepad", vbNullString)
> If intHandle > 0 Then
> SendMessage(intHandle, WM_CLOSE, 0, 0)
> End If
>
> So I want to use this code to close the internet explorer,So i put
Microsoft
> Internet Explorer instaed of Notepad but it does not work and I put
WordPad
> instaed of Notepad also it does not work,how can I do that ?
>
> any help will be appreciated
>
> Husam
>
|