Link to home
Start Free TrialLog in
Avatar of mike_marquet
mike_marquet

asked on

Using AfxFindResourceHandle in non MFC application !

How can I use the AfxFindResourceHandle in my non MFC application. When it is not possible, how to write the same
function for non MFC application.
Avatar of AndreasF
AndreasF

You have to find out what dlls are loaded to your program and search in all those dlls with FindResourceHandle.
I have no Idea, how you could get the list of loaded dlls.
You have the mfc source (it comes with VC).  You can probably just unroll the AfxFindResourceHandle code there into your own function.
Avatar of mike_marquet

ASKER

Rectification what I want is not AfxFindResourceHandle but
AfxGetInstanceHandle.

Sorry
ASKER CERTIFIED SOLUTION
Avatar of alanpa
alanpa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is my suggestion:
Make a header-file with a global HINSTANCE-Variable (hMyInstance) and the function MyGetInstanceHandle(). Include this header in every sourcefile and assign the appropriate hInstance to hMyInstance in every DllMain and WinMain. Then, when you want the handle call MyGetInstanceHandle which returns this global variable (or even use hMyInstance directly :-).

Sorry alanpa, that's the same as you wrote, but I was just writing this as you answered and I didn't want to delete, what I wrote.
Thanks to all.