Sign in to follow this  
Guest jeffro

Retrieving gauge handle

Recommended Posts

Hi,I'm trying to load a resource BITMAP (defined in the .rc file) from my gauge by using a handle to the gauge itself, but have been unsucessful in retrieving the handle. I've tried several variations of the following, all unsuccessful:h_gauge = GetModuleHandle(NULL);h_gauge = GetModuleHandle("MYGAUGE.gau");h_gauge = GetModuleHandle("MYGAUGE.gau.");h_gauge = GetModuleHandle("GaugesMYGAUGE.gau.");If I can get the module handle then I'd use it with the Bitmap constructor, Bitmap::Bitmap(HINSTANCE,WCHAR*), like this:Bitmap my_image(h_gauge, L"BMP_PITCH_MARKS");Does anyone know how to retrieve the module handle for the gauge?Thanks,- Jeff

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Do you need the module handle or the resource handle (is there a difference?). The resource handle is extra_data while PANEL_SERVICE_PRE_INSTALL.e.g.HINSTANCE res_handle=NULL;..case PANEL_SERVICE_PRE_INSTALL: res_handle=(HINSTANCE)extra_data); break;...I use this handle for loading resources e.g. with "LoadString".For the module handle throw out the DLLMain definition in the GAUGE_TABLE_BEGIN macro and define your own:BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) { ....//something with hDLL } I have never tried if these handles are the same or lead to the same results though.Arne Bartels

Share this post


Link to post
Share on other sites

P.S.both methods do give the same. For gauges you should use "res_handle=(HINSTANCE)extra_data;", you can use DllMain, but it's a bit more work, for FS DLL modules the only way, though.Arne Bartels

Share this post


Link to post
Share on other sites

Arne,I tried both methods you outlined and came up with the same result...I was able to get the module handle I needed. Works great! Thank you so much.By the way, I've learned a lot by reading your responses to other people's questions on this forum. Much appreciated and keep up the good work.- Jeff

Share this post


Link to post
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
Sign in to follow this