February 1, 200521 yr 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
February 1, 200521 yr 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
February 1, 200521 yr 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
February 1, 200521 yr 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
Create an account or sign in to comment