Microstation C# Update 14 C++: Issue with mdlSystem_enterGraphics() API

Hello Experts,

As a part of our process, we have a MDL application which takes input in the form a buffer and write the data to DGN files. But recently observed that it is working fine when being run as an administrator, but is not working when being invoked as a user.

On deeper analysis observed that the API "mdlSystem_enterGraphics()" seems to be not returning back and hence the issue. And when we tested on v8 it is working fine for both the user as well we administrator.

Could anyone let us know if the behaviour of the mentioned API is changed from V8 to CE and started looking for some kind of permissions?

Thanks in Advance.

Regards,

Harish.

  • Hi ,

    Most older/legacy MDL applications should update their code to call mdlSystem_enterGraphicsExtended added to ensure an MDL application could dynamically choose when to enable or disable their need to view (and process certain types of) design file data. See if this helps or helps provide more insight into some other (not yet seen) issue.

    void mdlSystem_enterGraphicsExtended  ( int  flags )  
    
    Serves the same purpose as mdlSystem_enterGraphics, except that it allows applications to initialize MicroStation's graphics environment without displaying design files. 
    
    This is useful, for example, in INITAPPS applications that process design files and want to display dialog boxes, but don't want the drawing displayed on the screen. 
    
    Parameters
    [in] flags Whether MicroStation displays design file views or not. If flags is 0, MicroStation does display them, if flags is 1 it does not. Other values for flags are reserved.  
    
    See also
    mdlSystem_enterGraphics 
    Remarks
    Required Library: mdlbltin.lib 

    Thank you and HTH,
    Bob 



  • Hi Harish,

    On deeper analysis observed that the API "mdlSystem_enterGraphics()" seems to be not returning back and hence the issue.

    Can you provide some details or explanation what do you mean by "not returning back"?

    What I can see in MicroStation CE U16 using my older code when I tested MS_INITAPPS mechanism, it works as expected: MicroStation entered graphics with previous opened design file, the rest of code is run and MicroStation is normally interactive.

    But recently observed that it is working fine when being run as an administrator, but is not working when being invoked as a user.

    I do not see any difference, when testing MS_INITAPPS code, when MicroStation is started as user or administrator.

    With regards,

      Jan

  • Thanks Robert Hook.

    We'll look into making use of the "mdlSystem_enterGraphicsExtended" API as suggested. 

    Thanks Jan Slegr.

    By not returning, we mean the control is going into the method and exiting from there instead of coming back into the .ma applcation so that further process can continue.

    Another point I missed to mention is, the issue is seen only on few machines, but working fine on others i.e., in few machines, it works fine both as admin and as user, but in few it works only if run as admin. Could it have anything to do with the security levels or the installation privileges.

    Thanks and Regards,

    Harish.

  • Could it have anything to do with the security levels or the installation privileges

    That depends on your MicroStation configuration.  If a default configuration, MicroStation CONNECT configuration variable MS_MDLAPPS points to folder something like C:\Program Files\Bentley\MicroStation CONNECT Edition\MicroStation\mdlapps.   That folder (along with most of the C: drive) is a Windows protected folder.  You must have Windows admin rights to make any change to that folder.

    In your case, what is the definition of MS_MDLAPPS

    How do you build your app.?

    1. Using Viz Studio?
      • You must run Viz Studio with 'elevated permission' (a.k.a. 'as Administrator'?) to write the result of the build to the C: drive
      • Viz Studio
      • You can create a Windows shortcut that automatically elevates Viz Studio
    2. Using bmake?
      • You should run bmake from the SDK command shell started as a Windows administrator

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jon Summers,

    Thanks for the reply.

    We have checked and found that the "MS_MDLAPPS" variable is not pointing to any path. It is blank.

    We are building our application by running bmake .in the Microstation SDK as adminstrator.

    If my understanding is correct, in case we are building the .ma application as a user(not as admin) we should have a problem while creating the .ma application itself where as in our case, the problem is while using the .ma application.

    Thanks and Regards,

    Harish.

  • We have checked and found that the "MS_MDLAPPS" variable is not pointing to any path. It is blank.

    Check again.  Many MicroStation tools & utilities are delivered as AddIns or Applications, and are installed in that folder.  The MS_MDLAPPSvariable is required so that MicroStation can find those tools.  It is set during installation.  If it is blank then MicroStation won't function correctly.

    MS_MDLAPPS

    If my understanding is correct, in case we are building the .ma application as a user(not as admin) we should have a problem while creating the .ma application

    MicroStation and its sub-folders, including the \MicroStation\mdlapps folder, are installed to the C:\Program Files folder (unless you choose otherwise).  That's a Windows protected folder.  The installer must be run with Windows administration rights to create the MicroStation installation.

    If you want to create an AddIn or Application that builds MDL or DLL files then those files must be copied to the \MicroStation\mdlapps folder.  Because it's a Windows protected folder, the build tool (bmake or Viz Studio) must be run with Windows administrator privilege.

    our case, the problem is while using the .ma application

    Once an AddIn or Application has been copied to the \MicroStation\mdlapps folder, a user may invoke the app. using MicroStation key-in mdl load appname.  You don't need to be an administrator to run MicroStation, nor do you need to be an administrator to load an app.

    Thread Hijack

    You've hijacked your own thread, because Windows permissions and software installation have nothing to do with mdlSystem_enterGraphics().

    Consider starting a new post.

     
    Regards, Jon Summers
    LA Solutions