Load MDL app on Application Startup (MS_INITAPPS)

I am facing some issues in Successful loading MDL apps on Startup.

 

I have modified code as below and loaded MDL app.

 

if (strcmp(l_str_argument.c_str(), "MS_INITAPPS") == 0)

{

       mdlSystem_enterGraphics();

 

       mdlInput_sendCommand(CMD_DIALOG_OPENFILE, L"STARTUP", MSInputQueuePos::INPUTQ_HEAD, NULL, 0);

 

       SystemCallback::SetFileSaveFunction(OnFileSaveCallBack);

}

 

 

After executing above code, I am able to get MicroStation window. When I select any file displayed , Application gets crashed.