Send Topic Feedback | See Object Hierarchy Chart
PC-DMIS 2022.2 Object Library
Getting Started > Windows 7 Automation Notes
Windows 7 Automation Notes

A restriction in Windows 7 may prevent an automation application running at a lesser privilege level to run another application at a higher level. Noteably this occurs when using C# as the automation language.

For example, if you ran PC-DMIS manually using the "Run as Administrator" option, your computer remembers this in a manifest. If you then attempt to run PC-DMIS via your custom automation application, but that application uses a lesser privilege level, it will fail to automate PC-DMIS.

If this occurs, either run PC-DMIS as a standard user or run the custom automation application using the higher privilege level expected by PC-DMIS.

 

Other things to try:

1. Run your program as administrator to make sure the problem is not caused by Win7 UAC.

2. Do NOT use "new PCDLRN.Application" to create PCDLRN.Application object, since it could cause PC-DMIS version problems. Try to use CreateInstance(type) as shown in the example below to create the application object instead.

    private void StartPcdmis() 
    {
      FormMain main = (FormMain)this.MdiParent;
      Type comType = null;
      object comObj = null;
      try
      {
        //Get type of Application through ProgID of PC-DMIS Application.
        comType = Type.GetTypeFromProgID("PCDLRN.Application");
        //Create instance of PC-DMIS through application type
        comObj = Activator.CreateInstance(comType);
      }
      catch (System.Exception em)
      {
        MessageBox.Show(em.Message);
      }
      main.pcdApplication = comObj as PCDLRN.Application;
      main.pcdApplication.Visible = false;
    }


3. When you add pcdlrn reference into your project, it is better to add interoperation library (normally named Interop.PCDLRN.dll) instead of directly adding the PCDLRN COM registered in your system. If not, your custom application won't do anything when you uninstall PC-DMIS, or if you've installed PC-DMIS but have not yet ran it as an administrator for the first time.
 
4. If you are distributing the custom application onto other computers, ensure that when PC-DMIS is installed on those computers, it is started as an administrator at least once so PC-DMIS will register itself.