How to open an IE window in my applications?

  • Thread starter Thread starter rainlake
  • Start date Start date
R

rainlake

I want to open an IE window in my application in Compact Framework,how?

Thanks a lot!
 
Hi RainLake!!!

The following code works for me. I'm copying & pasting it with no
guaranties that it will work for you. In fact, you might also need to review
it. Why am I posting it then??? Because I also copied it for myself from
another posting about 3 months ago!!!! :)

Public oMyProcessInfo As ProcessInfo = Nothing
Public blnWasInternetExplorerLaunched As Boolean

'***** Windows Function Declarations... *****'
Declare Function CloseHandle Lib "CoreDll.dll" (ByVal Handle As IntPtr)
As Int32
Declare Function CreateProcess Lib "CoreDll.dll" (ByVal imageName As
String, _
ByVal cmdLine As
String, _
ByVal
lpProcessAttributes As IntPtr, _
ByVal
lpThreadAttributes As IntPtr, _
ByVal
boolInheritHandles As Int32, _
ByVal dwCreationFlags
As Int32, _
ByVal lpEnvironment As
IntPtr, _
ByVal lpszCurrentDir
As IntPtr, _
ByVal si As Byte(), _
ByVal pi As
ProcessInfo) As Integer
Declare Function GetLastError Lib "CoreDll.dll" () As Int32





'***** Routines... *****'
Public Function LaunchMSIE(ByVal strURL As String) As Boolean
Dim lngResult As Int32
Dim lngErrorCode As Int32
Dim si(128) As Byte
Dim WAIT_OBJECT_0 As Int32 = 0

Try
blnWasInternetExplorerLaunched = False
If (Not (oMyProcessInfo Is Nothing)) Then
CloseMSIE()
End If
oMyProcessInfo = New ProcessInfo

lngResult = CreateProcess("IExplore.exe", strURL, IntPtr.Zero,
IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, si, oMyProcessInfo)
If (lngResult = 0) Then
lngResult = CreateProcess("IESample.exe", strURL,
IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, si, oMyProcessInfo)
If (lngResult = 0) Then
lngErrorCode = GetLastError()
blnWasInternetExplorerLaunched = False
Else
blnWasInternetExplorerLaunched = True
End If
Else
blnWasInternetExplorerLaunched = True
End If

Catch ex As Exception

End Try

Return blnWasInternetExplorerLaunched
End Function




Public Sub CloseMSIE()
If ((Not (oMyProcessInfo Is Nothing)) And _
(blnWasInternetExplorerLaunched = True)) Then
Try
CloseHandle(oMyProcessInfo.hThread)
CloseHandle(oMyProcessInfo.hProcess)
Catch ex As Exception
End Try
oMyProcessInfo = Nothing
End If
End Sub


Hope it helps!!!

Tarh ik
PS: This posting has been posted "AS IS". As such, I'm not responsible for
this piece of code. Use it on your own.
 
Thank u all about this .
but i want to reduce my application's size and memeory occuption
I just want to use the standerd cf
 
Huh? How does that response apply to *looking* for the answer to a question
before *asking* the question?!

If, as I suspect, you are talking about OpenNETCF, then *think* about what
you're saying before you say it. OpenNETCF has source available. You can
use just what you need, if you want to.

Paul T.
 
Back
Top