C++ Wrapper for mdlNativeWindow_api
In the absence of a MicroStationAPI NativeWindow class, you can write your own wrapper class to help in this situation. Put the initialiser in your class construction, then add methods that wrap the MDL functions you need. In this example …
struct MdlNativeWindowWrapper { MdlNativeWindowWrapper () { mdlNativeWindow_initialize ("unused"); } HWND GetMainHandle (int screen = 0) { return mdlNativeWindow_getMainHandle (screen); } };
Usage …
MdlNativeWindowWrapper wrapper; HWND mainWindow = wrapper.GetMainHandle ();
Using your wrapper rather than the raw MDL functions means that you can't forget to initialise. You probably recognise this as an implementation of RAII.