Jump to content
The simFlight Network Forums

Send Message to FS2004


Recommended Posts

Hi,

Can anyone please tell me how i can send message to fs9.1. I've tried all kinds of code, and in different languages including C#, VB6, VB.Net, C. But it doesn't work. FSUIPC ver 3.9.9.1(non-registered).

char *msg="This is a test\0";
short int ctrl=0;

FSUIPC_Write(0x3380, strlen(msg)+1, &msg, &dwResult);
if(FSUIPC_Process(&dwResult));

FSUIPC_Write(0x32FA, 2, &ctrl, &dwResult);
if(FSUIPC_Process(&dwResult));

The above is a C code that I'm trying to use. Nothing happens. I'm able to read/write simple values but unable to display the message.

Any help is much appreciated.

Thanks.

Regards,

Nathan

Link to comment
Share on other sites

Can anyone please tell me how i can send message to fs9.1. I've tried all kinds of code, and in different languages including C#, VB6, VB.Net, C. But it doesn't work. FSUIPC ver 3.9.9.1(non-registered).

The facility is okay here with 3.998. I'm sure 3.991 is okay too.

you have a basic C error. You define msg as a pointer to a string, and then, when calling FSUIPC_Write you take the address of that pointer (&msg). So the parameter being passed is a pointer to a pointer, not to a string.

You can use msg as it is as the pointer to the string, because that's what it is, or use &msg[0] to point to its first character.

Also it is very inefficient to use a separate Process for each read or write. Your code would be better as:

char *msg="This is a test\0";
short int ctrl=0;

FSUIPC_Write(0x3380, strlen(msg)+1, msg, &dwResult);
FSUIPC_Write(0x32FA, 2, &ctrl, &dwResult);
FSUIPC_Process(&dwResult);

Not sure why you are using "if" on the Process call when you aren't doing anything if it fails.

The above is a C code that I'm trying to use. Nothing happens.

You are writing a single line, so also check that you don't have the option to suppress single line messages set on FSUIPC's "About" option page.

Pete

Link to comment
Share on other sites

Ah yes. Had changed to msg in my code but didn't update the code here.

And thanks for your prompt help. I figured out what the problem was. Checked the FSUIPC log. it was loging alright Something about the output going to ADVDisplay. Unchecked it in the modules menu and it appeared.

Thanks again

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.