G
Guest
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
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