1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Anyone using FSUIPC 4 with SDK r27 c++ library?

Discussion in 'SimConnect' started by davidt, 17/9/07.

  1. davidt

    davidt

    Joined:
    15/8/07
    Messages:
    34
    Country:
    canada
    Hi,

    I've been playing around with trying to use FSUIPC 4.16 (just downloaded this morning), and using the C++ library of the SDK r27.

    Has anyone been using this? If so, what version of VS are you using? I've been trying with VS2005 and VC++2008 beta and been running into all sorts of errors trying to get the simple UIPCHello.cpp working.

    First I had errors after creating an empty project with it complaining about the use of chars vs. LPWSTRs. I fixed that.. but then started getting an error about LIBC.lib not being found.

    I wasn't sure if it was something I was doing or not, so I started a new win 32 console project, and when I include the FSUIPC_User.h file and recompile (while not even trying to make any calls), I get errors:

    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(37) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Version'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(39) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_FS_Version'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(41) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Lib_Version'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(41) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(41) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(45) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Open'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(45) : error C2146: syntax error : missing ')' before identifier 'dwFSReq'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(45) : error C2059: syntax error : ')'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(46) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Open2'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(46) : error C2146: syntax error : missing ')' before identifier 'dwFSReq'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(46) : error C2059: syntax error : ')'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(48) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Read'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(48) : error C2146: syntax error : missing ')' before identifier 'dwOffset'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(48) : error C2059: syntax error : ')'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(49) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_ReadSpecial'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(49) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(49) : error C2146: syntax error : missing ')' before identifier 'dwOffset'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(49) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(49) : error C2059: syntax error : ')'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(50) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Write'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(50) : error C2146: syntax error : missing ')' before identifier 'dwOffset'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(50) : error C2059: syntax error : ')'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(51) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Process'
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(51) : error C2065: 'pdwResult' : undeclared identifier
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user.h(51) : fatal error C1903: unable to recover from previous error(s); stopping compilation


    Has anyone been able to use the C++ library?? If so, what version of visual studio? Was there anything you needed to do to get it to work? What am I missing/doing wrong here?

    Thanks,
    David
  2. Golf-HotelDelta

    Golf-HotelDelta

    Joined:
    20/12/04
    Messages:
    9,419
    Country:
    unitedkingdom
    I have no problem with VC++ .NET Version 7, but I don't have the file FSUIPC_User.h, only FSUIPC.h.

    If I use VC++ 2005 Express Edition I get other errors.

    George
  3. davidt

    davidt

    Joined:
    15/8/07
    Messages:
    34
    Country:
    canada
    Hi Golf,

    .net v7 - that's also known as .net 2003, correct?

    I think my error earlier was that I was using the wrong C version of the SDK. I had another look and am now looking at the MFC version of the SDK.

    Still some weird problems, though. It builds fine in VC6, however when I try to run it I get an error and it crashed, giving me the "Do you want to send this error to Microsoft" dialog box.

    I noticed that the other c sdk has a lib file. Do you include anything like that into your project? I'm guessing there might be an error because it can't find something. If not.. I'm unsure what could be giving me that message, because I'm simply compiling and running the included example.

    Thanks,
    David
  4. Golf-HotelDelta

    Golf-HotelDelta

    Joined:
    20/12/04
    Messages:
    9,419
    Country:
    unitedkingdom
    Yes, that's correct.

    No, just the standard $(VCInstallDir) plus $(FrameworkSDKDir)

    Try creating an MFC Dialog application and use the debugger.

    George
  5. Golf-HotelDelta

    Golf-HotelDelta

    Joined:
    20/12/04
    Messages:
    9,419
    Country:
    unitedkingdom
    The UIPCHello example won't work in FS9 or FSX. It uses:

    static char *pFS[] = { "FS98", "FS2000", "CFS2", "CFS1", "Fly!", "FS2002" };

    and

    (FSConnection.GetVersion() & 0xffff) ? 'a' + (FSConnection.GetVersion() & 0xff) - 1 : 0x0);

    will fail on FS9 and above.

    George
  6. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    There's no C++ examples or library provided in the FSUIPC SDK. All my code is C only, not C++.

    The examples in the SDK are just that -- examples. They are for READING. Any C programmer should be able to read them and understand them easily. Even the source of the library is provided, so you don't need to use that either, you can do your own thing entirely. The interface is completely open and usable in any language, you just need to read it and understand it, and this is why I kept to basic C with no complications.

    The errors you list in FSUIPC_User.h appear to be due to the omission of the BOOL typedef. Did you forget to include the Windows.h before including the FSUIPC header?

    I've also replied to the same post in my Support Forum.

    Regards

    Pete
    Last edited: 18/9/07
  7. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    It's provided as an example, not the solution for everyone to copy verbatim. The little exercise to update it for other versions is left to the reader. ;-)

    Pete
  8. Golf-HotelDelta

    Golf-HotelDelta

    Joined:
    20/12/04
    Messages:
    9,419
    Country:
    unitedkingdom
    Yes Pete, when I opened the example yesterday, it produced a dialog for a helipad :confused:

    I had forgotten that I had modified it many moons ago as my first attempt at using FSUIPC. Since then I have created many other applications for both FS9 and FSX.

    George
  9. davidt

    davidt

    Joined:
    15/8/07
    Messages:
    34
    Country:
    canada
    Hi Golf,

    I had gotten around the problem with the chars by changing them to wchar_t types, and putting an L in front of the quotes. Seemed to work with that.

    so:
    Code:
    static wchar_t *pFS[] = { L"FS98", L"FS2000", L"CFS2", L"CFS1", L"Fly!", L"FS2002" };

    Pete: if these are only example interfaces, is there any documentation regarding how to program using FSUIPC directly?

    Thanks,
    David
  10. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    The SDK contains the source of the Library, which provides the C code for the interface itself. You can built it all into your program in any way you wish. there is nothing hidden. Once the common memory area is established via memory mapped file facilities, there's actually just the one call (via a SendMessageTimeout), and the rest is merely a matter of data formats, which you can see from the struct definitions in the header.

    I haven't provided any tutorials on how to program in C, if that's what you mean. I thought the C source would be sufficient. The interface is actually 100% identical to that established by Adam Szofran in the FS5 and FS6 versions of his module. All he ever did was provide the headers and the same type of source as I have -- no library as such. I tried to make it a little easier with the wrappers, it was never meant to confuse. I've had no complaints of such confusion in the 7 or 8 years it's been available.

    If you are not all that familiar with C, then possibly the Visual Basic examples and sources would be more readable for you?

    Regards

    Pete
    Last edited: 18/9/07
  11. davidt

    davidt

    Joined:
    15/8/07
    Messages:
    34
    Country:
    canada
    Thanks Pete,

    I'm pretty sure I can figure out the programming part of it - it's the how to use FSUIPC part I'm a little lost on.

    For example, how then do I do something like subscribing to a system event using the functions provided in the C header? All I see is open, close, read, write and process.

    What functions do I use to get callback results such as system events?

    Thanks,
    David
  12. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    There are no such things as "system events" or "callbacks" in the FSUIPC interface. You are thinking of something else entirely, like SimConnect. The FSUIPC interface is a memory read/write emulating interface, like "peek/poke, not "client/sever"". The Library facilities provided reflect that. Don't you see "read", "write", "process"? Where do you get the idea of system events and callbacks?

    Please look at the code in the examples. That is what they are for. It isn't surprising you can't get anywhere if you aren't looking at what is available. :-(

    Regards

    Pete
  13. davidt

    davidt

    Joined:
    15/8/07
    Messages:
    34
    Country:
    canada
    Hi Pete,

    I have looked at the examples, which is why I'm asking these questions.

    I know SimConnect can offer me access to system events. I'm wondering if/how I can get at that data through FSUIPC, that's all.

    So apparently the answer is no. Thank you.

    David.
  14. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    What "system event" is not detectable through one or other of the Offsets supported by FSUIPC4, please? If it is needed and not there, I can add it. If it is new to FSX then it probably isn't really appropriate, but everything which was supported for previous versions of FS should be there, as they were then. I can add new things if needed, but on the whole folks developing only for FSX would be using SimConnect.

    Either way, it wouldn't be labelled "system event", however, as "eventing" is simply not something which occurs in such an interface.

    Please just clarify what it is you want to do rather than make such blanket incorrect assumptions.

    Regards

    Pete
  15. davidt

    davidt

    Joined:
    15/8/07
    Messages:
    34
    Country:
    canada
    I was looking to see if I would be able to do something similar to "SimConnect_SubscribeToSystemEvent(4sec)" with FSUIPC, where my application would be getting a callback with some data every 4 seconds from SimConnect.

    I don't think it's a "blanket incorrect statement" based on looking at the functions available, and you telling me: "There are no such things as "system events" or "callbacks" in the FSUIPC interface".

    Like I said, if there's a way, please let me know. I'd rather not create a timed polling loop if I can get some kind of callback instead. I'm just trying to (quickly) evaluate whether or not I can use FSUIPC in the way that I think I need to.

    Thanks
    David
  16. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    24,162
    Country:
    wales
    If you are working with FSX and need callbacks and events then you might consider using simconnect direct rather than going through FSUIPC4. Pete will correct me if I am wrong but FSUIPC4 uses SimConnect to get it's information.
  17. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    Such things in a polling interface are done by using Windows WM_TIMER calls or TimerProcs.

    Sorry, it is, simply because most of the "system events" that tell you anything (other than simple wake-ups which are easy in many other ways) are covered by updating the relevant Offset in FSUIPC's memory mapped way of doing things.

    You are simply completely misconstruing the entire way the interface works. I think, if you feel you need a Client/Server interface with callbacks and events you should go to Simconnect direct and forget versions of FS before FSX. Is that not suitable for you?

    Check out the standard Windows API "SetTimer". You can use that not only to receive WM_TIMER messages but, alternatively, to set a callback to a "TimerProc".

    Check the list of offsets and see if the data and/or control you require is present. Otherwise, and especially if you are only interested in FSX and future versions of FS, forget FSUIPC and look at SimConnect.

    Regards

    Pete
  18. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    Yes, it does, for 95% of its current needs. Hopefully 100% in the future, but possibly dropping to 80% if MS doesn't sort out the weather interface sufficiently in due course. That's the main area in which the provisions are significantly less than FSUIPC managed (by hacking) in previous versions of FS. I'd rather not have to hack into the weather implementation a fourth time -- the previous times took hundreds, even thousands of hours each. :-(

    Regards

    Pete
  19. DanKH

    DanKH

    Joined:
    18/5/07
    Messages:
    221
    Country:
    denmark
    Hi

    Sorry to interfere, but David, you might want to have a look at this to understand the ins and outs of IPC (Inter-Process Communication)

    http://msdn2.microsoft.com/en-us/library/aa365574.aspx

    Especially the Pipes part

    or here:
    http://www.cs.cf.ac.uk/Dave/C/node23.html#SECTION002300000000000000000
    and messaging:
    http://www.cs.cf.ac.uk/Dave/C/node25.html#SECTION002500000000000000000

    FSUIPC is "just" a specialized IPC for Flight Simulator (hence the FS) the U-part I'm not sure about, but my guess is 'User' or something. A module that provide the developer an easi(er) access to the memory-areas that the FS-process uses. There no 'hacking' involved other than a laborious work of finding what the vast amount of address spaces hides within the process.

    To Inter Communicate with a running process you need to understand the IPC part of FSUIPC, and reading the msdn article mentioned should give you some better idea of what is going on. Unlike Simconnect which acts like a Client/Server as mentioned correctly. SimConnect can use the "Client-part" of the FS-process to communicate, whereas IPC's have to use the messaging system (not to compare with the Messenger service found in Services! which is a whole other ballgame)

    What Pete and his predecessors has done for us, is the FSUIPC and a very good SDK so everyone with the will to RTFM shouldn't have it too complicated in making an add-on that rely on data exchanges with FS. On top of that Pete has several other areas of the FS-process covered, eg. areas for controlling joysticks, weather etc. etc. and that is the part you pay for. For merely access to all the wonders, "offsets" or memory areas, the only price you have to pay is time to read the manual.

    Sorry if I'm learning granny to blow eggs here, but somebody might get a bit better understanding of what a IPC really is. FSUIPC is "just" that: A FS-specialized IPC, where most of the hard work is already done.
    Last edited: 18/9/07
  20. davidt

    davidt

    Joined:
    15/8/07
    Messages:
    34
    Country:
    canada
    Pete:
    As for me misunderstanding - entirely possible. After reading your post again it sort of cleared it up.

    As for why I want to get at the timed events from FSX. I'm going to need to create a few other planes, and then updated their positions. Ideally in sync with when FSX prepares its visual frames, because I don't want AI controlled planes using flight plans or anything like that. (The 4sec thing was just an example - I know i'd need to do it a lot faster).

    If I used a timer in my application, then how will I know if I'm trying to send updated info to FSX in sync with when it's drawing it?

    As for FS requiements. This will only be for FSX and above. I'm looking at FSUIPC because I had tried creating a class to keep all my SimConnect methods together, but then found that the dispatch proc needed to be static in order to be passed to FS. Maybe that's not as big an issue as I had originally thought?

    I'm trying to get data from another simulation which will be providing the locations of other planes I want to see flying around. This applicaiton is completely OO, and in C++. I wanted to have another class to handle my communication with SimConnect, so I wouldn't have global functions or variables sitting around in the application.


    DanK: Thanks for that link. It's slowly making more and more sense. lol.

Share This Page