R
Roberto M. Oliva
Hello all!!
I need to run ActiveSync automatically from inside my application. This
seems to work great with the following code.
Dim ret As Integer
Dim pi As New ProcessInfo
ret = CreateProcess("repllog.exe", "", IntPtr.Zero, IntPtr.Zero, 0, 0,
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pi)
If ret = 0 Then
Label1.Text = String.Format("Result: 0 (Unable to execute ActiveSync)")
Else
WaitForSingleObject(pi.hProcess, INFINITE)
End If
The problem is that i need to know if the connection was succesfully
established or otherwise there was a problem.
Maybe one solution is to launch the repllog process and, at the same time,
launch another thread to test that the device is docked with the following
code:
Private Function IsDeviceDocked() As Boolean
Dim sHostName As String
Dim ipheThisHost As IPHostEntry
Dim ipThisAddr As IPAddress
Dim ip, localhost As String
IsDeviceDocked = False
Try
sHostName = Dns.GetHostName
ipheThisHost = Dns.GetHostByName(sHostName)
ipThisAddr = ipheThisHost.AddressList(0)
ip = ipThisAddr.ToString
localhost = IPAddress.Parse("127.0.0.1").ToString
If Not (ip = localhost) Then IsDeviceDocked = True
Catch
End Try
End Function
I don't know if this works, I willl test it, but probably there must a
simpler way... isn't it?
Can anybody help me?
Thanks a lot!!
Roberto
I need to run ActiveSync automatically from inside my application. This
seems to work great with the following code.
Dim ret As Integer
Dim pi As New ProcessInfo
ret = CreateProcess("repllog.exe", "", IntPtr.Zero, IntPtr.Zero, 0, 0,
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pi)
If ret = 0 Then
Label1.Text = String.Format("Result: 0 (Unable to execute ActiveSync)")
Else
WaitForSingleObject(pi.hProcess, INFINITE)
End If
The problem is that i need to know if the connection was succesfully
established or otherwise there was a problem.
Maybe one solution is to launch the repllog process and, at the same time,
launch another thread to test that the device is docked with the following
code:
Private Function IsDeviceDocked() As Boolean
Dim sHostName As String
Dim ipheThisHost As IPHostEntry
Dim ipThisAddr As IPAddress
Dim ip, localhost As String
IsDeviceDocked = False
Try
sHostName = Dns.GetHostName
ipheThisHost = Dns.GetHostByName(sHostName)
ipThisAddr = ipheThisHost.AddressList(0)
ip = ipThisAddr.ToString
localhost = IPAddress.Parse("127.0.0.1").ToString
If Not (ip = localhost) Then IsDeviceDocked = True
Catch
End Try
End Function
I don't know if this works, I willl test it, but probably there must a
simpler way... isn't it?
Can anybody help me?
Thanks a lot!!
Roberto