Jump to content
The simFlight Network Forums

FSUIPC_WAPI, keep getting "not a valid Win32 app" on initial build


Demon

Recommended Posts

Win10 Home v10.0.19045
FSUIPC 7
VS 2022 64bit v17.5.4
NET framework 4.8.09037



1491979033_FSUIPC_WAPIcompilewin32.png.818cf8ce1b98951d7cc624c58b02a211.png


My system path:
610710625_SystemPath.png.b45309d152a10ce0062c269199df9e0b.png


Net info:
DotNet.png.5da8073c5b304e20d131cabaf198bcb7.png


VS config:
1316483393_VSconfig.png.10b7fe903d5dcc73d5ce527c5cd9e2a6.png


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

Link to comment
Share on other sites

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 by John Dowson
Further info added
Link to comment
Share on other sites

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!
 

Link to comment
Share on other sites

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
 

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.


324310681_Objective1.png.b3d753a12a5e5329ec4033d82aa3029f.png

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

Link to comment
Share on other sites

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 DependenciesFSUIPC_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: 

  • Like 1
Link to comment
Share on other sites

Win10 Home v10.0.19045
FSUIPC 7
VS 2022 64bit v17.5.4
NET framework 4.8.09037


I'm getting NULLPTR error:

image.png.98e746faf7cffe10b40bc0cf2adfd44b.png


And errors on my main program (worked previously):

image.png.3e4107f0873bdabc2e9d1171b8285e17.png


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:

image.png.01e0864d0bd05f00cc7f634d78ad30b4.png


VS configs, your Client on left, mine on right:

image.thumb.png.d53e1f6ebb305283606d527f092e424b.png

image.thumb.png.a14a20fc051771f5021e5138746c27db.png

image.thumb.png.9a9677b315b299b876c99a1cef5637a2.png

image.thumb.png.fab1982a47e0a1f58326e80e900109bc.png

The extra SimConnect.lib and user32.lib is from my original GUI tests.
 

image.thumb.png.4d73e08c3a1f842305d439205d7c47c9.png


I'm not sure which of your includes are only required to drive that Menu-driven GUI.

Robert

 

 

Link to comment
Share on other sites

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..."

Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

I used x64 'cause that's what the MSFS SDK encouraged.
x64.png.323261b72cc4e4a7a4b4e300016a84f7.png

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

 

Link to comment
Share on other sites

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

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.