hexagon logo

Program to Open PC-DMIS

I am currently attempting to write a program (VB.NET) that will have a PC-DMIS program's file name passed to it. This program should then start PC-DMIS if it isn't already running, and open the program that was passed to it. If PC-Dmis is already running, then it should open the program that was passed to it. Then, the program should close, leaving PC-DMIS running. I also want PCDMIS to be opened as Operator Mode.

I am attempting to do this by referncing PCDLRN within the program. Hwoever, I am having little luck with the .OperatorMode=true method.

The reason I am attempting to do this in VB.NET is I will then follow up with some additional programming (saving info to a DB and what not) that would be cumbersome as a .VBS etc.

This PCDMIS 2011 MR1 and VB.NET 2010 (.NET 4.0)

Imports System.IO


Public Class Form1

    Public PCDApp As PCDLRN.Application
    Public PCDPartPrograms As Object
    Public PCDPartProgram As Object

    Public fileName As String = "C:\Work\31580 - 1 - 12345.PRG"


    Private Sub Application_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        If File.GetAttributes(fileName) = FileAttributes.ReadOnly Then
            File.SetAttributes(fileName, FileAttributes.Normal)
        End If

        StartApplication(fileName)

    End Sub ' Application_Load



    Public Sub StartApplication(ByVal _fileName As String)

        PCDApp = CreateObject("PCDLRN.Application")
        PCDPartPrograms = PCDApp.PartPrograms

        PCDApp.Visible = True
        PCDPartPrograms.Open(_fileName, "CMM1")

    End Sub


End Class
Parents

  • That definitely works with VBA in Excel 2010. Fascinating - I can switch PC-DMIS in and out of Operator mode without exiting! Opens new vistas for my own controlling program (written in Delphi Pascal).


    So, I got tired of my whole machine logging out when my application crashed trying to start PCDMIS in Operator Mode. Here is a key in the PCDMIS registry that stops that behavior. Set it to 'False' and save.
Reply

  • That definitely works with VBA in Excel 2010. Fascinating - I can switch PC-DMIS in and out of Operator mode without exiting! Opens new vistas for my own controlling program (written in Delphi Pascal).


    So, I got tired of my whole machine logging out when my application crashed trying to start PCDMIS in Operator Mode. Here is a key in the PCDMIS registry that stops that behavior. Set it to 'False' and save.
Children
No Data