How to get window main handle?

My code is as follows:


#include <Mstn\MdlApi\MdlApi.h>
#include <Mstn\cmdlist.r.h>
#include <Mstn\MdlApi\msnativewindow.h>
#include <windows.h>
#include <DgnPlatform\DgnFile.h>
#include <DgnPlatform\DgnFileIO\DgnFileIOApi.h>

extern "C" DLLEXPORT void MdlMain(int argc, WCharCP argv[])
{
             HWND hWnd = NULL;
             hWnd = (HWND)mdlNativeWindow_getMainHandle(0);


            return;

}

I can't able to resolve these build errors.

Parents Reply
  • The project still fails to compile

    Incorrect!  His project compiles OK.

    Building a C++ project takes several steps...

    1. Compile MicroStation resources (command tables, dialogs, message lists etc)
    2. Compile Windows resources (message lists, version info etc)
    3. C++ pre-processor
    4. Compile C++ code
    5. Link

    Examine his build log to see this...

         Creating library C:\Users\RVARAT~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\hc_microstation.lib and object C:\Users\RVARAT~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\hc_microstation.exp
    hc_microstation.obj : error LNK2019: unresolved external symbol mdlNativeWindow_getMainHandle referenced in function MdlMain
    C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\hc_microstation.dll : fatal error LNK1120: 1 unresolved externals
    

    The log is telling you that function mdlNativeWindow_getMainHandle() is used, but the linker can't find its implementation.  The implementation is in a library (*.lib) file, but that's not specified in his bmake file.

     
    Regards, Jon Summers
    LA Solutions

Children
No Data