Demon Posted April 18, 2023 Report Posted April 18, 2023 Win10 Home v10.0.19045 FSUIPC 7 VS 2022 64bit v17.5.4 NET framework 4.8.09037 My system path: Net info: VS config: I've built several x64 sample projects recently, including Paul Henty's stuff. I don't know if WAPIMaster needs to be compiled as win32, or if I'm accidentally building it as Win32. I can't find any relevant reference to x86 or x64 in the forum, and the download page doesn't say which; only mentions x64 for FSUIPC. I just need a kick in the right direction. Robert
John Dowson Posted April 18, 2023 Report Posted April 18, 2023 (edited) It isn't a valid Win32 application. Its an API, and builds the FSUIPC_WAPI.lib. You cannot run it - has no main. If you want an application that uses it, that is what the WASMClient is, also available on github. Btw, I will move your post to the FSUIPC7 support forum, as the FSUIPC WAPI is only valid for MSFS / FSUIPC7. 21 minutes ago, Demon said: I can't find any relevant reference to x86 or x64 in the forum x86 is 32-bit, x64 64-bit. You should build it as x64. You should be able to just built it (not run it!) with the VS solution file provided. John Edited April 18, 2023 by John Dowson Further info added
Demon Posted April 18, 2023 Author Report Posted April 18, 2023 6 minutes ago, John Dowson said: It isn't a valid Win32 application. Its an API, and builds the FSUIPC_WAPI.lib. You cannot run it - has no main. If you want an application that uses it, that is what the WASMClient is, also available on github. Btw, I will move your post to the FSUIPC7 support forum, as the FSUIPC WAPI is only valid for MSFS / FSUIPC7. x86 is 32-bit, x64 64-bit. You should build it as x64. You should be able to just built it (not run it!) with the VS solution file provided. John GAAAAAAA, I was compiling.... It built just fine using BUILD. Thanks!
Demon Posted April 18, 2023 Author Report Posted April 18, 2023 Quote If you want an application that uses it, that is what the WASMClient is, also available on github. Yeah, that's what I'm looking at now. I'm a main-frame programmer by trade that has dabbled in VB6, and now putzing with VS2022 and C++. At least I was able to get the MSFS SDK code examples in C++ working to use the SimConnect events. I'm just stuck on identifying in WASMclient exactly what parts of code are required to use the API (getting the data area populated, reading/setting the Lvars, etc). I don't need the Hvars and other stuff. Looks like I'm off to StackOverflow to beg for help. 😄 Thanks again for your interface and utilities; they help a lot of people get things done. Robert
John Dowson Posted April 19, 2023 Report Posted April 19, 2023 12 hours ago, Demon said: Looks like I'm off to StackOverflow to beg for help. Probably better to ask here... The WAPI should be relatively straightforward to use: 1. First get an instance: WASMIF* WasmPtr = WASMIF::getInstance(); (you can also pass in a pointer to a logging function if you like, otherwise the WAPI will create and use its own log file). 2. Set any config options required, using, for example, to set the log level to DEBUG, use: WasmPtr->setLogLevel(LOG_LEVEL_DEBUG); Other config functions: WasmPtr->setSimConfigConnection(connectionNo); // to set the SimConnect connection number - only needed in certain circumstances, e.g. running on a client PC WasmPtr->setLvarUpdateFrequency(freq); // sets the frequency for the WAPI to request lcar updates/values. Recommended NOT to use this, and configure frequency in the WASM WasmPtr->registerUpdateCallback(availableCallbackFunction); // register a function to be called when lvars are loaded/reloaded and available for use. Recommended to USE this function WasmPtr->registerLvarUpdateCallback(lvarCallbackFunction); // register a function to be called when lvar values change. You also ned to flag lvars for this callback 3. Start the WAPI: WasmPtr->start(); Once started, you can use the other functions to get/set/list lvars and hvars once they are available, which is indicated by the ca;;back to the function registered with the registerUpdateCallback method. If you have registered an lvarUpdateCallback, you should also flag the lvars for callback with the registerLvarUpdateCallback method in the registerUpdateCallback method. 4. Close/terminate the session: WasmPtr->end(); // Terminate the WASM connection Thats it really... Note that you shouldn't need to use the reload method any more as this is now done automatically (by the WASM), but can still be used. 1
Demon Posted April 20, 2023 Author Report Posted April 20, 2023 Ok, to start there has to be some process to import the files in your FSUIPC_WAPI folder into my VS2022 Solution. I uploaded my current code to github, including your WAPI folder: LINK DELETED https://github.com/KaptainKrash/MSFSinterface.git My first objective was to connect to FSUIPC_WAPI and change Lvar 058 between a 0 and a 1. I kept the 2 connections buttons separate to help in debugging. I've tried a few things and failed miserably. I'm still at the "must follow detailed instructions level". I also tried to strip your Client program, but I don't need all the menu-driven material; it was beyond my lmits to convert to a basic GUI. Robert
John Dowson Posted April 20, 2023 Report Posted April 20, 2023 4 hours ago, Demon said: Ok, to start there has to be some process to import the files in your FSUIPC_WAPI folder into my VS2022 Solution. You just add the header files to your project, and include the WASMIF.h file in the source files where you want to use the WAPI, and specify the WAPI include folder (as well as maybe the SimConnect one, if you are planning to use that) under the C/C++ Additional Incude Directories. Also add the FSUIPC_WAPI.lib to your project. Then you need to set the VC++ Directories -> Library Directories to add locations for both the WAPI and SimConnect libraries, and then add the following libraries to the Linker -> Input -> Additional Dependencies: FSUIPC_WAPI.lib;SimConnect.lib;Ws2_32.lib;Shlwapi.lib (and debug versions for the debug configuration. Take a look how the build for the WASMClient is set-up and try and follow that. I haven't got time to clone/download and look at your project, or to help with building standard apps, but if you can explain what your problem actually is maybe I can point you in the right direction: 1
Demon Posted April 20, 2023 Author Report Posted April 20, 2023 Win10 Home v10.0.19045 FSUIPC 7 VS 2022 64bit v17.5.4 NET framework 4.8.09037 I'm getting NULLPTR error: And errors on my main program (worked previously): I copied the Header files directly into my folder, also copied in the FSUIPC_WAPI folder (with include, lib and 6 files) and Added Existing Items from Header tab to my Solution: VS configs, your Client on left, mine on right: The extra SimConnect.lib and user32.lib is from my original GUI tests. I'm not sure which of your includes are only required to drive that Menu-driven GUI. Robert
John Dowson Posted April 21, 2023 Report Posted April 21, 2023 You seem to be using the .Net framework. I have no experience with this and cannot help you with .Net. Also, if using .Net, you should use the dll instead of the lib. or Paul Henty;s client dll for .Net which includes a wrapper for the WAPI - see 1
Demon Posted April 21, 2023 Author Report Posted April 21, 2023 I listed the framework in my top post in case it helped in debugging. I have no clue what a framework eats for lunch. 😄 The only framework.h I see in the code, is the one listed in the #INCLUDES on FSUIPC_Client. I kept that only to do whatever it is you're doing. Robert "dazed..."
John Dowson Posted April 22, 2023 Report Posted April 22, 2023 You have to decide which UI framework you want to use. You seem to have chosen WinForms, which is a .Net framework. I have never used .Net or any of its associated frameworks, so cannot really help you. Try google or StackOverflow to get you started on windows GUI programming, and try and get a basic (non-functional) GUI running first. You can then add the WAPI once you have an understanding of the GUI framework you are using, and then a simconnect connection if you also want to use that. The WASMClient just uses the old/original Win32 API with no additional framework layers, as does FSUIPC. John 1
Demon Posted April 22, 2023 Author Report Posted April 22, 2023 I used x64 'cause that's what the MSFS SDK encouraged. I'm trying to get the AddToDataDefinition command working in my standalone C++. SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "L:XMLVAR_ADF_Mode", "number", SIMCONNECT_DATATYPE_FLOAT64, 0, 0); MSFS SDK Docs say it can be used to GET/SET an Lvar. Quote L Vars It is possible to get and/or set an RPN "L" variable through SimConnect using the SimConnect_AddToDataDefinition function, for example: SimConnect_AddToDataDefinition(hSimConnect, DataDefinitionID, "L:VARIABLE_NAME", "number", SIMCONNECT_DATATYPE_FLOAT64); I just haven't figured out the proper syntax yet. Tried a gazillion variations, nothing worked. I bet I'm missing something else That RPN comments seems like some sort of red herring to make us chase after our tail. 😄 I'm running FSUIPC7 in parallel to check Lvar content. Robert
John Dowson Posted April 22, 2023 Report Posted April 22, 2023 1 minute ago, Demon said: I used x64 'cause that's what the MSFS SDK encouraged. Of course - that just means that its a 64-bit application, not a 32-bit one (x86). This is not related to the frameworks you are using. The .Net framework is usually used with C# (or maybe VB). I think it can ve used with C++ but I don't know anything about this. You should decide if you want to use .Net or not, and if so which other .Net framework you want to use for the GUI. Otherwise, just start with the Win32 API without ,Net. 3 minutes ago, Demon said: MSFS SDK Docs say it can be used to GET/SET an Lvar. Yes - the ability to read and write to lvars using simconnect was recently added to the SDK, and works in the same way as you would read and write/update a simvar. But I have not used simconnect for lvars yet, as I implemented the WASM to be able to do this before this was made possible via SimConnect. Sorry, but this is not the place for simconnect programming or support, or basic windows GUI programming. There are many other resources available for this. I only have time to support the products I provide. John
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