Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binary resource in Windows service?

Status
Not open for further replies.

RFickling

Programmer
Aug 29, 2004
3
US
Hi,

I don't know if this is the appropriate forum for this question, but I don't know any other place to post it. 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 = lpApp->m_hInstance;

How can I access this resource?

Thanks,
Royce
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top