Win32 DLL not linking resource files?
Hi there
got an issue with DLLs under Win32. I''m using vc6 under W2K. So here is my problem:
I got two projects in my workspace. The first is an Win32 Console Application. The second is a Win32 DLL. The DLL uses classes and in the main class there is a DlgProc and a function to call DialogBox. This means I use Resource Templates in my DLL. If I compile the project VC says that it compiles the resource, the sources and then it links all together. (fine) No errors occur. The .plg (html) shows that the linker also got the .res file to link in.
The EXE is using the produced .lib file to acces the class via an exported function. Then it accesses a method of the class which will open the dialog. Boom! The DialogBox-Call returns -1. GetLastError = 1812 (ERROR_RESOURCE_DATA_NOT_FOUND) ??? Where is it gone?
I changend my linker settings to generate a map file. I thought I can see where the resources are gone. But no resource sections are shown?! Is it something with a C/C++ setting or maybe a linker setting in the DLL??? (I know that there are some project which HAVE resources in their DLLs - so it should work)
Some more info ''bout the project:
demo.exe
- win32 console application
- code generation = single threaded
- no resource.h or resource.rc in project (should work without)
- the way it should work:
hGUI = createGUI(); // the exported func
hGUI->showDialog();
gui.dll
- win32 dynamic link library
- exports createGUI
- generates .lib (used in EXE)
- code generation = multi-theaded dll
- resource.h and resource.rc are used
- resource.res specified under settings->resources
- the way this should work:
MyGUI *createGUI() { return new MyGUI; }
class MyGUI {
public:
virtual void showDialog();
private:
static BOOL CALLBACK _dialogProc( ... );
};
MyGUI::showDialog() {
DialogBox( this->_hInstance, MKINTRES(IDD_DLG), NULL, _dialogProc );
}
BOOL MyGUI::_dialogProc( ... ) {
...
}
Is this->_hInstance equal to the application instance or the DLL''s instance? If the resource is in the DLL it should be the DLL''s instance.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement