Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework.sdk
Getting IE Handle from User Control
Norm Dotti
12/5/2002 3:38:00 PM
If I have a .NET User Control running within IE is there a
way to get the Windows handle of the IE instance it's
running in? Parent returns Nothing if I check for it.
3 Answers
(Mike Clay (MSFT))
12/5/2002 5:43:00 PM
0
Hi Norm,
This article may help....I'm not sure if you can implement this into your
User Control or not.
http://www.c-sharpcorner.com/Code/2002/Mar/CaptRunIEIns...
Mike Clay, MCSD
Beta Technical Support
This posting is provided "AS IS" with no warranties, and confers no rights.
© 2002 Microsoft Corporation. All rights reserved.
Norm Dotti
12/5/2002 7:27:00 PM
0
I was able to Call PostMessage(lhWndApp, WM_CLOSE, 0, 0)=20
to IE from a user control and it does close it. My problem=20
is that if I have several instances of IE running and they=20
all have the same title bar how do I know which is the one=20
that contains the control I just performed some action on=20
(say a button click)?
>-----Original Message-----
>Hi Norm,
>
>This article may help....I'm not sure if you can=20
implement this into your=20
>User Control or not.
>
>
htt...
sharpcorner.com/Code/2002/Mar/CaptRunIEInstances.asp
>
>Mike Clay, MCSD
>Beta Technical Support
>
>
>This posting is provided "AS IS" with no warranties, and=20
confers no rights.=20
>=A9 2002 Microsoft Corporation. All rights reserved.=20
>
>.
>
Norm Dotti
12/5/2002 8:47:00 PM
0
The following works. The code resides in a user control.=20
If that control is embedded in an HTML page and an event=20
is triggered by the user (e.g. File>Exit) from within the=20
user control it will close the current instance of IE.
Private Const WM_CLOSE =3D &H10
Private Declare Function PostMessage Lib "user32.dll"=20
Alias "PostMessageA" (ByVal hWnd As IntPtr, ByVal wMmsg As=20
Integer, ByVal wParam As Integer, ByVal lParam As Integer)=20
As Integer
Private Declare Function GetParent Lib "user32" (ByVal=20
hwnd As IntPtr) As IntPtr
Dim ParentWindow As IntPtr
Dim IEInstanceHandle As IntPtr
ParentWindow =3D GetParent(Me.Handle)
While Not (IntPtr.Zero.Equals(ParentWindow))
IEInstanceHandle =3D ParentWindow
ParentWindow =3D GetParent(ParentWindow)
End While
Call PostMessage(IEInstanceHandle, WM_CLOSE, 0, 0)
>-----Original Message-----
>Hi Norm,
>
>This article may help....I'm not sure if you can=20
implement this into your=20
>User Control or not.
>
>
htt...
sharpcorner.com/Code/2002/Mar/CaptRunIEInstances.asp
>
>Mike Clay, MCSD
>Beta Technical Support
>
>
>This posting is provided "AS IS" with no warranties, and=20
confers no rights.=20
>=A9 2002 Microsoft Corporation. All rights reserved.=20
>
>.
>
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Getting IE Handle from User Control
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password