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.
Hi Rajesh,
Rajesh Varatharajan said:I have modified code as below
Did you use some example as template?
I am aware of the only example of MS_INITAPPS specifically for CE (maybe more exist), and it uses mdlDialog_cmdNumberQueue (false, CMD_DIALOG_OPENFILE,"STARTUP",TRUE);
Rajesh Varatharajan said:Application gets crashed.
Did you try to debug MicroStation during the whole process?
Another option, that often help, is to use e.g. WinDbg and to analyze exception log and memory dump. Sometimes it's necessary to configure MicroStation to create memory dump with more details.
Even when from your information it seems MicroStation crashes, not your code, information in the dump may help to analyze why.
Does the problem persist when workspace (not No workspace) is used?
With regards,
Jan
P.S. Instead of polluting the post by many duplicated tags, I recommend to follow the best practices and to use standardized subject format to share mandatory information (product + version + language). Now it's not clear what MicroStation version do you use. Plus, please use Insert > Insert code tool when you want to share any code snippet. It's annoying to read code formatted as plain text.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Rajesh Varatharajan said:if (strcmp(l_str_argument.c_str(), "MS_INITAPPS") == 0)
Most C++ strings in MicroStation CONNECT are Unicode (WChar, a typedef of wchar_t). Bentley WString is an good string container, based on std::string.
WChar
wchar_t
WString
std::string
A better test would be...
extern "C" DLLEXPORT void MdlMain ( int argc, WCharCP argv[] ) { MdlApplicationClass appClass {mdlSystem_getMdlAppClass (nullptr)}; switch (appClass) { case MdlApplicationClass::User: { StartedByUser (argc, argv); break; } case MdlApplicationClass::InitApp: { StartedAsInitApp (argc, argv); break; } case MdlApplicationClass::DGNApp: { StartedAsDgnApp (argc, argv); break; } default: { // Ignore other startup modes WString msg; msg.Sprintf (L"MdlApplicationClass %d not handled", (int)appClass); ... break; } } }
Regards, Jon Summers LA Solutions
Thanks Jon for your reply.I tried this same behavior observed
Rajesh Varatharajan said:When I select any file displayed
Try mdlSystem_enterGraphicsExtended(0) instead of mdlSystem_enterGraphics().
mdlSystem_enterGraphicsExtended(0)
mdlSystem_enterGraphics()
Tried with that too.
same behavior.Is there anything I need to change in this?
Rajesh Varatharajan said:same behavior
L"STARTUP"
Log not captured at that location."STARTUP" i have taken from initapp sample application.
Rajesh Varatharajan said:initapp sample application
Please supply more detail. I don't see an INITAPP sample in the CONNECT SDK.
7484.initapp.zipIt was referred by MicroStation Support Team.
please also compare with example from ..\ Documentation\Migration\Workshop\Labs\MigrationTesting\v0811\initapp\initapp.cpp
Rajesh Varatharajan said:It was referred by MicroStation Support Team
That's an old example from the days of MicroStation V8.
Rajesh Varatharajan said:..\ Documentation\Migration\Workshop\Labs\MigrationTesting\v0811\initapp
That's a better example. If you build that example, does it work for you?
I notice that example's function MdlMain() uses 8-bit C strings, which is obsolete. MdlMain for CONNECT looks like this:
MdlMain()
MdlMain
extern "C" DLLEXPORT void MdlMain (int argc, WCharCP argv[])