Binary resource in Windows service?


I have a Windows service in which I have an embedded binary resource that I want to load at service startup. However, the API functions below fail with an exception or return NULL:

Both of these calls throw an exception when called by my service:

HINSTANCE hInstance = AfxGetInstanceHandle();

HINSTANCE hInstance = AfxGetResourceHandle();

This always returns a NULL when called by my service:

CWinApp* lpApp = AfxGetApp();
HINSTANCE hInstance = lpApp->m_hInstance;

How can I access this resource?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!