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?