Objective Grid: How can I create a 32-Bit extension DLL that uses Objective Grid?

Article ID: 485
Last updated: 25 Apr, 2018
Article ID: 485
Last updated: 25 Apr, 2018
Revision: 3
Views: 4574
Posted: 11 Jan, 2001
by Meltreger B.
Updated: 25 Apr, 2018
by Meltreger B.

Problem

 


How can I create a 32-Bit extension DLL that uses Objective Grid?

 

 


Cause

 


 

 


Action

 


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.

  1. With Project|Open, load dllhuskdllhusk.sln
  2. Click on TestDll1 files in the workspace window
  3. With right mouse, click select Settings?
  4. Select TestDll1 ? Win32 Debug and TestDll1 ? Win32 Release
  5. Click on C/C++ Settings and add _GXEXT
  6. Click OK.
  7. Open testdll1.cpp
  8. Insert
    #include gxall.h

    directly after #include stdafx.h

  9. Change the following function. The bold text indicates what needs to be changed:
    extern C extern void WINAPI InitTestDLL1()
    {
    GXInit();

    // Create a new CdynLinkLibrary for this app
    new CDynLinkLibrary(extensionDLL);

    // Register the doc templates we provide to the app
    CWinApp* pApp = AfxGetApp();
    ASSERT(pApp != NULL);
    pApp->AddDocTemplate(new CmultiDocTemplate(IDR_TEXTTYPE,

    RUNTIME_CLASS(CTextDoc),
    RUNTIME_CLASS(CMDIChildWnd),
    RUNTIME_CLASS(CGXGridView)));
    pApp->AddDocTemplate(new CmultiDocTemplate(IDR_HELLOTYPE,
    RUNTIME_CLASS(CDummyDoc),
    RUNTIME_CLASS(CMDIChildWnd),
    RUNTIME_CLASS(CHelloView)));
    // add other initialization here
    }

  10. Rebuild All. This will build all DLLs and the application.

  11. 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:

CGXTabBeam::RegisterClass(hInstance);
CGXTabWnd::RegisterClass(hInstance);


 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 485
Last updated: 25 Apr, 2018
Revision: 3
Views: 4574
Posted: 11 Jan, 2001 by Meltreger B.
Updated: 25 Apr, 2018 by Meltreger B.

Others in this category