VB6 RAPI reconnecting to PPC
I can connected to a device perfectly fine the first time I run my code as long as there is a partnership (guest is fine). When I try to reconnect or use a different device I cannot reconnect until I restart my pc.
Am I leaving something open that is not letting me reconnect later?
I am using the module from this site: http://support.microsoft.com/kb/307256
This is my code: (I took out lots of CASE statements, I am just worried about the connecting)
Code:
Dim ShortCutNum As Integer
Dim ScPath As String
Dim ScFileName As String
'populate list based on selection
End Sub
'populate list based on selection
End Sub
Private Sub CmdMake_Click()
Dim StrCmb1, StrCmb2, StrCmb3 As String
'This makes sure a device is connected
If RapiConnect Then
MsgBox "Status: Connected!"
Else
MsgBox "Status: Disconnected!"
End If
If Not RapiIsConnected Then
MsgBox "Device is not connected. Please connect first."
Exit Sub
End If
'MsgBox "Got past it"
StrCmb1 = Cmb1.Text
StrCmb2 = Cmb2.Text
StrCmb3 = Cmb3.Text
Call FileWrite
Cmb2.Enabled = False
Cmb3.Enabled = False
Cmb2.Clear
Cmb3.Clear
ShortCutNum = ShortCutNum + 1
CmdMake.Caption = "Make Another Shortcut"
lblSC.Caption = lblSC.Caption & vbCr & "Shortcut #" & ShortCutNum & " is: " & ScFileName
'**** Make sure there are not too many shortcuts
'This sends the file to the device
Call RAPICopyPCFileToCE(ScFileName, "\Windows\Start Menu\" & Replace(ScFileName, "C:\", ""))
End Sub
Sub FileWrite()
Dim sFileText As String
Dim iFileNo As Integer
iFileNo = FreeFile
'open the file for writing
Open ScFileName For Output As #iFileNo
'If this file already exists it will be overwritten!
'write some text to the file
Print #iFileNo, ScPath
'close the file (if you dont do this, you wont be able to open it again!)
Close #iFileNo
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call RapiDisconnect
End Sub
Re: VB6 RAPI reconnecting to PPC
Hi,
possibly the disconnect is failing.
There is a superb library and article on VB6 Rapi here