ACAE
asked on
Get the windows handle
Hello,
I'm trying to establish an internet connection using the InternetAutodial function. The second parameter you need to pass is the windows handle (I'm using it on a PDA, so .NET COMPACT FRAMEWORK is used).
How can I get the windows handle in vb.net ?
This is the code I use now :
Private Const INTERNET_AUTODIAL_FORCE_ON LINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UN ATTENDED = 2
InternetAutodial(INTERNET_ AUTODIAL_F ORCE_UNATT ENDED, 0&)
This returns this error : NotSupportedException
I'm trying to establish an internet connection using the InternetAutodial function. The second parameter you need to pass is the windows handle (I'm using it on a PDA, so .NET COMPACT FRAMEWORK is used).
How can I get the windows handle in vb.net ?
This is the code I use now :
Private Const INTERNET_AUTODIAL_FORCE_ON
Private Const INTERNET_AUTODIAL_FORCE_UN
InternetAutodial(INTERNET_
This returns this error : NotSupportedException
ASKER
I have 2 problems :
- Process type doesn't seem to be supported by the .net compact framework
- If I try this on a normal windows application, I get an error : 'No process is associated with this object'
Any ideas ?
- Process type doesn't seem to be supported by the .net compact framework
- If I try this on a normal windows application, I get an error : 'No process is associated with this object'
Any ideas ?
Ill have another look at it today, I pulled this out of some code i use to setfocus back to my application using its hwnd, ill just have to see what bits I missed. But first im going to have to install vs.net again, thats a nice hour wait to think about it :)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
GetHandle(Me.Name) 'Call using WindowTitle as parameter
End Sub
Sub GetHandle(ByVal strWindowTitle As String)
Dim hWnd As Long
Dim objProcess As New Process()
Dim objProcesses() As Process
objProcesses = Process.GetProcesses()
For Each objProcess In objProcesses
If UCase(objProcess.MainWindo
hWnd = objProcess.MainWindowHandl
Exit For
End If
Next
MsgBox(hWnd)
End Sub
That does the trick
Regards
Jaz
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The problem is that with the compact framework the type 'processed' is not supported. Anyhow, we bought a dll from another company (intelliprog) whch does the job. Thanx for your help
Dim objProcesses() As Process '
objProcesses = Process.GetProcesses()
iWnd = objProcess.MainWindowHandl
Along those lines, sorry I cant currently test anything, laptop's decided it doesnt like me (again).
Regards
Jaz