rapi.deviceshell or rapi.createprocess

Ian Bone

New Member
I've just downloaded Basic4ppc and taking it for a trial spin and having a few "basic" problems and looking for help.

I'm on the trial license so running from within the IDE.
All I want my little program to do from the Desktop is to connect to my Device, then launch a Pocket Excel File "\My Documents\My Documents\Power.xlsx"
Having browsed the online help for most of my code, I have been told to use rapi.deviceshell(program,file) but this is not a selectable function when I type rapi.
So when I use it, I get the error saying it is an invalid property of rapi.
I see a rapi.CreateProcess(program,file), but when I use it, it complains that there is "No Connected device", but there is.....?

What am I supposed to use?


Sub Globals

End Sub
Public Sub Connect_To_Device
rapi.New1
rapi.Connect2(False)
t=Now
Do Until rapi.Connected
DoEvents
If (Now - t)/cTicksPerSecond>3 Then
Msgbox("Can not get connected")
End If
Loop
Msgbox("Connected!")
rapi.deviceshell("pxl","\My Documents\My Documents\Power.xlsx")
' rapi.CreateProcess("pxl","\My Documents\My Documents\Power.xlsx")

End Sub

Sub App_Start
main.Connect_To_Device
End Sub


I have declared "rapi" as an Object of type RAPI. I have included the RAPIDesktop and the OpenNetCF..... Components in the IDE.

Thanks

Ian.



[EDIT]
Confused - I just closed the IDE, undocked my phone, (HTC Touch HD), waited a second or two until Vista 64bit Ultimate detected the device removed, re-docked it, re-launched the IDE, and ran the program with the rapi.CreateProcess("pxl","\My Documents\My Documents\Power.xlsx") and bingo it launched on the device! I then closed Excel on my Phone and re-ran the program and then got the error: "No Connected Device. The requested lookup ley was not found in any active activation contect." But I still got my msgbox("Connected") displayed saying I was connected!?
 
Last edited:

Ian Bone

New Member
You should only add a reference to RAPIDesktop.dll.
Then add a RAPIDesktop object. It should have the method DeviceShell.

....I had declared an object of type RAPI, not RAPIDesktop.....the .DeviceShell is now available. Again, however, I only get one run at it. It lauches Excel, but when I run again, I get an error at the connect: "Value does not fall within the expected range." If I close the IDE and re-open it, it runs once again and then the same error. Close the IDE and re-open and it runs one more time etc...do I need to reset or drop a connection at the end of my program?

Thanks again.

Ian
 

Ian Bone

New Member
Not sure if it will help, but please try to add Rapi.Dispose before closing the application.
You can use Form_Close event for doing it.

Note that this problem will probably not occur in a compiled application.

I've tried a rapi.dispose, but still have to close and re-open the IDE for a second run of the program. I assume the IDE is to blame for this.....

Thanks for your help. I'll play for another couple of programs before I decide to continue with it.

Thanks.

Ian.
 
Top