• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3D v4 64-Bit DLL Guages

Messages
368
Country
unitedkingdom
I've been using the ESP example DL gauge for various projects up to P3D3 with no real problems, mainly so I can use SimConnect to tweak the engine handling, add external stores etc. Obviously with the move to 64-bit they need to be recompiled, however after setting the project to 64-bit and pointing towards the P3D4 inc and lib files I get the following error:

error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'PGAUGE_CALLBACK'

along with that I get a second message:

IntelliSense: no instance of function template "GDIPlus_Gauge::Callback" matches the required type g:\Users\Bing\Dropbox\Gauges\GDI+Gauge\GaugeDeclarations.cpp 26 1 GDIPlus_Gauge

The associated block of code is:

GAUGE_HEADER_FS1000(
GAUGEHDR_VAR_NAME,
GAUGE_W,
transparent_gauge_name,
&gaugeTransparent_element_list,
gaugeTransparent_mouse_rect,
GDIPlus_Gauge::Callback<TransparentGauge>,
0L, 0L,
gauge_guid2,
0, 0, 0, 0, 0);

To eliminate anything I may have done I went back to the original example code which generated exactly the same problems. Has anyone got any ideas what might need updating to get the code to compile for 64-bit?
 
You have to use the v4's gauges.h. The 3rd parameter of the gauge callback is no longer a UINT32 but a UINT_PTR. The user_data member in your gauge header is also a UINT_PTR now instead of UINT32.
 
Naruto, thanks for the pointers, I think I've solved that problem, I was using the v4 gauges.h but hadn't made the UNIT32 UINT_PTR.
But now I get the errors listed below, so I'm not sure if I've solved the initial problem or just made it worse!

Errors.png
 
Sweet thanks guys, that seems to be compiling happily now so any remaining problems are due to my poor use of the SimConnect API!!
Really appreciate it.
 
Hi, everyone!

I am using D2DGauge example available on this forums.
It compiles and works successfully on FSX, as it makes sense for P3D x64 I have to recompile the library and use the newly provided SDK (Simconnect & Gauges.h).

GAUGE_HEADER_FS1000(
GAUGEHDR_VAR_NAME,
GAUGE_W,
opaque_gauge_name,
&gaugeOpaque_element_list,
gaugeOpaque_mouse_rect,
D2DGauge::Callback<OpaqueGauge>,
0,
0,
gauge_guid1,
0, 0, 0, 0, 0
);



And change one method definition to:
template <class T>
inline void FSAPI D2DGauge::Callback(GAUGEHDR* gau, int serviceId, UINT_PTR)
{
switch(serviceId)
{
}
}

But Prepar3D 4.2 keeps crashing if the library dll is placed into panels folder or if placed in addons folder the gauge doesn't work.

Do we need to make more changes when switching from fsx to p3d?

Has anyone experienced something similar?


Off-topic:
offtopi.JPG
offtopi.JPG
 
Last edited:
Ahh, I found the error by myself, so in gauges registration callback we have to use UINT_PTR instead of UINT32 ...


template <class T>
inline void FSAPI D2DGauge::Callback(GAUGEHDR* gau, int serviceId, UINT_PTR)
{
switch(serviceId)
{
case PANEL_SERVICE_CONNECT_TO_WINDOW:
assert(gau->user_data == 0);
gau->user_data = reinterpret_cast<UINT_PTR>(new T);
reinterpret_cast<T*>(gau->user_data)->mCanvas = reinterpret_cast<PELEMENT_STATIC_IMAGE>( gau->elements_list[0] );
break;
...
}
}
 
Back
Top