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.
mike_marquetAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndreasFCommented:
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.
0
alanpaCommented:
You have the mfc source (it comes with VC).  You can probably just unroll the AfxFindResourceHandle code there into your own function.
0
mike_marquetAuthor Commented:
Rectification what I want is not AfxFindResourceHandle but
AfxGetInstanceHandle.

Sorry
0
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

alanpaCommented:
Oh - either save the instance handle (HINST) as a global in WinMain, or use:
GetWindowLong(hWnd, GWL_HINSTANCE);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndreasFCommented:
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.
0
mike_marquetAuthor Commented:
Thanks to all.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.