Send Topic Feedback | See Object Hierarchy Chart
PC-DMIS 2023.1 Object Library
Members 
PCDLRN ActiveX DLL : Application Object
Application Object
Description

The Application object represents the PC-DMIS application.

Object Model
Application ObjectPartProgram ObjectApplicationObjectEvents ObjectApplicationSettings ObjectAutomationSettings ObjectPointData ObjectRegistrySettings ObjectLabelTemplates ObjectLmsLicense ObjectMachines ObjectPartPrograms ObjectPortLock ObjectReportTemplates ObjectApplication Object
Remarks

To start PC-DMIS using Automation from another application, use CreateObject or GetObject to return an Application object.

Launching PC-DMIS With Startup Options

Because of an inherent weakness in the way Microsoft designed the CreateObject function, the CreateObject doesn't allow startup parameters. This means when the code executes it will launch PC-DMIS always in ONLINE mode.

However, there is a way around this. Your code can dynamically create a special startup file that will cause PC-DMIS to launch with specific startup options.

In order to launch PC-DMIS via automation with a startup file you must do the following:

  • Create a text file named AutomationStartupOptions.txt.

  • Create a single line of text in the file with the available startup options. The PC-DMIS specific startup options include the following:

/f  - Launches in Offline mode.

/o - Launches in Operator mode.

/d - Launches in Debug mode.

/r - Launches in Reverse Axes mode

/postin - Launches in import mode. PC-DMIS will automatically import a specified file.

/postout - Launches in export mode. PC-DMIS will automatically export a specified file.

The line of text would look like this: /f /o /d /r /postin /postout

  • Launch PC-DMIS via automation.

When PC-DMIS starts, it checks to see if the AutomationStartupOptions.txt file exists. If it does, then it uses the file to set the necessary flags. However, when PC-DMIS closes, it will delete the text file. This means that the code you use to launch PC-DMIS must also create the needed text file on the fly or must rename an existing file to AutomationStartupOptions.txt. See the "Example Code from C++" below.

Automating in Online Mode: If you are trying to launch PC-DMIS in online mode, please note that the AutomationStartupOptions.txt file should not contain the /f startup parameter. Also, the machine parameter specified when using the Open or New methods of the PartPrograms object determines whether or not the measurement routine will run in offline or online modes. Of online mode, this parameter should be "CMM1".

Example
Below are some examples of how to launch PC-DMIS from C++ and Visual Basic: 
// Create my startup file

  int nIndex;

  CString szFileName, szLine(_T("/f"));

  GetModuleFileName (AfxGetInstanceHandle(), szFileName.GetBuffer (_MAX_PATH), _MAX_PATH);

  szFileName.ReleaseBuffer();

  nIndex = szFileName.ReverseFind('\\');

  szFileName = szFileName.Left(nIndex);

  szFileName += _T("\\AutomationStartupOptions.txt");

  CStdioFile StartupFile;

  if( StartupFile.Open(szFileName, CFile::modeCreate|CFile::modeWrite|CFile::typeText) )

  {

    StartupFile.WriteString(szLine);

    StartupFile.Close();

  }
Dim App as Object.
Set App = CreateObject("Pcdlrn.Application")
See Also