cgalusha Posted August 3, 2003 Report Posted August 3, 2003 Hi all, I have searched through the forum for a couple of hours now and had no luck, so I must revert to asking for help, for yet another person trying to interface with FS2002 using Visual Basic. Here's my issue: I'm trying to write a statement to update the Radio Audio Switches (COM1 vs. COM2 is active, Marker Sound, etc). Looking at the SDK documentation, it says to set the pSrce value to something similar to the following: 2^7 COM1 transmit 2^6 COM2 transmit 2^5 COM receive both Using simple multiplication, 2^7=128. If I perform an FSUIPC_Read, the value received is 128. However, if I pass that to FS2002 with FSUIPC_Write I get a Windows error stating that the memory address cannot be read/written to. I'm guessing I must be missing something obvious when interpreting the 2^7 setting, so any help that anyone can offer would be much appreciated. Thanks for your help, Chris
Shuval Posted August 3, 2003 Report Posted August 3, 2003 I haven't tried to use com switches yet, but it sounds like your using the wrong variable declaration to write the bytes. If you can post your code I'll take a look.
cgalusha Posted August 3, 2003 Author Report Posted August 3, 2003 This is the code that I'm using...just a couple of lines to make sure I can get it working..... Private Sub btnSwapCom2_Click() Dim dwResult As Long Dim auiComSwitch As Byte auiComSwitch = 64 Call FSUIPC_Write(&H3122, 1, auiComSwitch, dwResult) End Sub
Pete Dowson Posted August 3, 2003 Report Posted August 3, 2003 This is the code that I'm using...just a couple of lines to make sure I can get it working.....Private Sub btnSwapCom2_Click() Dim dwResult As Long Dim auiComSwitch As Byte auiComSwitch = 64 Call FSUIPC_Write(&H3122, 1, auiComSwitch, dwResult) End Sub I don't know VB, but perhaps the reference "auiComSwitch" in the call is giving a value of 64, instead of a POINTER (address) to the place where the value 64 is held. Don't you have a way of ensuring it is an address you pass? Pete
cgalusha Posted August 3, 2003 Author Report Posted August 3, 2003 Pete, You truly are a genius! I didn't realize that the VarPtr function that others are using in their VB code must be passing a pointer to the memory location. Sounds like it might be time for me to dig out the old "c" book and start coding with it instead. Thanks for the quick response, and I can see how this can be more than a full time job for you - you'll definitely be getting a payment for using FSUPIC and WideFS! Thanks again, Chris
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now