Accessing Instance & Resource Handle from an Extention DLL
-
Hi y'all, moving up in software development, I thought it was a good idea to dive into extention DLL's. I've developed a suite of database-access classes which has grown up to 30 files, so I thought it would be nice to pack all these in a .lib and .dll file so distribution would be easier. One of the features of the classes is creating a taskbaricon (which is a Dundas component, derived from CWnd). But ever since I put my classes inside an MFC extention DLL, the creation of the taskbaricon fails. This is the reason why: * First a window is created with CreateEx(0, AfxRegisterWndClass(CS_CLASSDC | CS_GLOBALCLASS), NULL, 0, 0, 0, 0, 0, NULL, NULL) However, AfxRegisterWndClass calls AfxGetInstanceHandle and returns a NULL-value or something. Even though MSDN says that AfxGetInstanceHandle should return the handle of the dll in this case... * After the window creation an icon has to be extracted from the resource (which I also put inside dll). But as soon as the icon is created using ::LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(nIDResource), RT_GROUP_ICON), MAKEINTRESOURCE(nIDResource)), things go wrong again. AfxFindResourceHandle calls AfxGetResourceHandle which also returns a NULL- or corrupt handle. X| So, my question is: How can I get the AfxGetInstanceHandle and AfxGetResourceHandle working well within my .dll?? Structured programming vs. chaotic mind boggling