|| | |||Browse by category|
How can I create a 32-Bit extension DLL that uses Objective Grid?
If you want to create a 32-Bit extension DLL that uses Objective Grid, the following steps are necessary:
- When compiling your 32-Bit extension DLL, the symbol _GXEXT must be defined.
- In the Initialization routine of your DLL, you have to call GXInit();
The following steps shows you how to modify the DLLHUSK sample provided with Visual C++ so that you can call Objective Grid methods from the sample extension DLL.
- With Project|Open, load dllhuskdllhusk.sln
- Click on TestDll1 files in the workspace window
- With right mouse, click select Settings?
- Select TestDll1 ? Win32 Debug and TestDll1 ? Win32 Release
- Click on C/C++ Settings and add _GXEXT
- Click OK.
- Open testdll1.cpp
directly after #include stdafx.h
- Change the following function. The bold text indicates what needs to be changed:
extern C extern void WINAPI InitTestDLL1()
// Create a new CdynLinkLibrary for this app
// Register the doc templates we provide to the app
CWinApp* pApp = AfxGetApp();
ASSERT(pApp != NULL);
pApp->AddDocTemplate(new CmultiDocTemplate(IDR_HELLOTYPE, RUNTIME_CLASS(CDummyDoc),
// add other initialization here }
Rebuild All. This will build all DLLs and the application.
- Now you can run dllhusk.
NOTE 1: If you want to access OG functions also from your application (dllhusk) in the above sample, you also have to specify _GXDLL for the C/C++ settings of the application (dllhusk).
NOTE 2: The macros DECLARE_REGISTER and IMPLEMENT_REGISTER register the class for the application by default, NOT the extension DLL. This causes a problem when trying to use the derived grid class in a dialog (of the extension DLL). The dialog will fail to load because the derived grid class is registered to the application and not the extension DLL.
To avoid this problem, be sure that you pass an instance handle of your extension DLL in the call to Register(). This will then register the window in your extension DLL instead of your application.
For example, CGXTabBeam and CGXGridWnd are registered with these macros, but instead of calling the default Register version, OG is calling: