Extracting Windows variable contents

Greetings all. 

I am trying to extract the contents from the "%userdomain%" windows variable for use in an MDL application, but I

am not having any luck.

I tried to set a new MS config variable....

_USERDOMAIN = $(%userdomain%)

this gave me "%userdomain%" as the contents of the new variable.

I have tried using "mdlSystem_getConfigVar" passing in "userdomain" or "%userdomain%" but neither worked.

Any help is appreciated!

Regards,

Bert

Parents
  • Environment Variables

    Bert ...

    Bert Fegyverneki:
    I am trying to extract the contents from the "%userdomain%" windows variable for use in an MDL application. I tried to set a new MS config variable.... _USERDOMAIN = $(%userdomain%) this gave me %userdomain% as the contents of the new variable.

    You don't need to set a MicroStation config. variable because MicroStation will interpret a system environment variable. The only time it won't do this is when you define a config. variable having the same name as an environment variable, which hides the system variable.

    The variable's name is userdomain, not %userdomain%. The percent symbols are meaningful only to Windows Explorer.

    Bert Fegyverneki:
    I have tried using "mdlSystem_getConfigVar" passing in "userdomain" or "%userdomain%" but neither worked.

    mdlSystem_getConfigVar doesn't exist: I assume you mean mdlSystem_getCfgVar. Can you show us a code sample?

    mdlSystem_getConfigVar is not as useful as mdlSystem_getExpandedCfgVar, which expands config. variables recursively:

    char* p = mdlSystem_getExpandedCfgVar ("MS_RFDIR");
    if (p)
    {
    mdlOutput_messageCenter (MESSAGE_DEBUG, "MS_RFDIR expanded (click to see value)", p, FALSE);
    free (p);
    }

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Environment Variables

    Bert ...

    Bert Fegyverneki:
    I am trying to extract the contents from the "%userdomain%" windows variable for use in an MDL application. I tried to set a new MS config variable.... _USERDOMAIN = $(%userdomain%) this gave me %userdomain% as the contents of the new variable.

    You don't need to set a MicroStation config. variable because MicroStation will interpret a system environment variable. The only time it won't do this is when you define a config. variable having the same name as an environment variable, which hides the system variable.

    The variable's name is userdomain, not %userdomain%. The percent symbols are meaningful only to Windows Explorer.

    Bert Fegyverneki:
    I have tried using "mdlSystem_getConfigVar" passing in "userdomain" or "%userdomain%" but neither worked.

    mdlSystem_getConfigVar doesn't exist: I assume you mean mdlSystem_getCfgVar. Can you show us a code sample?

    mdlSystem_getConfigVar is not as useful as mdlSystem_getExpandedCfgVar, which expands config. variables recursively:

    char* p = mdlSystem_getExpandedCfgVar ("MS_RFDIR");
    if (p)
    {
    mdlOutput_messageCenter (MESSAGE_DEBUG, "MS_RFDIR expanded (click to see value)", p, FALSE);
    free (p);
    }

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Children
No Data