Binary resource in Windows service? - Programmers Heaven

Howdy, Stranger!

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

Categories

Binary resource in Windows service?

RFicklingRFickling Posts: 14Member
Hi,

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?

Thanks,
Royce
Sign In or Register to comment.