Background info - I'm querying a database to get userid and IP address (scraped at login) and display it to the users in this VB application. All of it is working except the call to launch the CHF file. Below is the code for my onClick event. I can even see the CHF file launch (and see AWREM32.exe in the task manager) but as soon as it establishes a connection, it closes the remote connect and focus goes right back to the application. Anyone have any ideas why or see what i'm doing wrong?
Code:
On Error GoTo Err_cmdConnect_Click
Dim RemoteDataManager As Object
Dim RemoteDataObject As Object
Dim oApp As Object
Set oApp = CreateObject("AWREM32.Application")
Dim objFSO As New FileSystemObject
Set RemoteDataManager = CreateObject("WINAWSVR.REMOTEDATAMANAGER")
If objFSO.FileExists(RemoteDataManager.CurrentDirectory & "template.chf") Then
objFSO.DeleteFile RemoteDataManager.CurrentDirectory & "template.chf", True
End If
RemoteDataManager.CreateObject "Template.chf"
Set RemoteDataObject = RemoteDataManager.RetrieveObject("template.chf", ViewAndModify, "")
RemoteDataObject.ComputerName = Replace(m_sIP, " ", "")
RemoteDataObject.ConnectionType = "TCP/IP"
RemoteDataObject.AutoLoginName = "***"
RemoteDataObject.AutoLoginPassword = "***"
RemoteDataObject.WriteObject (0)
oApp.awConnect RemoteDataManager.CurrentDirectory & "Template.chf"
Exit_cmdConnect_Click:
Set objFSO = Nothing
Set RemoteDataManager = Nothing
Set RemoteDataObject = Nothing
Set oApp = Nothing
Exit Sub
Err_cmdConnect_Click:
MsgBox Err.Description
Resume Exit_cmdConnect_Click