I've just recently started trying to Automate PC-DMIS. We need a front end here for our operators, along w/ a few other things that pc-dmis is just plain slow at.
so far i've tried 3 different languages (VC++, VB.NET and C#.NET) and I get the same error in all of them (80040154 COM not Registered)
I can get pc-dmis to open, and it is visible, but i can't do anything past that. Is there something i'm not doing?
here is my code for C#:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace _1st_attempt { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { PCDLRN.Application App= new PCDLRN.ApplicationClass();//this works pc-dmis is open App.Visible = true;//pc-dmis is visible App.SetActive();//no error here PCDLRN.PartPrograms Parts = new PCDLRN.PartProgramsClass(); //COM ERROR 80040154 } private void button1_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); textBox1.Text = openFileDialog1.FileName; } } }
and for VB
#pragma once namespace junk { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System:[emoticon:6D505171FAA4497C85C5CA27290C555D]ata; using namespace System:[emoticon:6D505171FAA4497C85C5CA27290C555D]rawing; /// <summary> /// Summary for Form1 /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { this->SuspendLayout(); // // Form1 // this->AutoScaleDimensions = System:[emoticon:6D505171FAA4497C85C5CA27290C555D]rawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System:[emoticon:6D505171FAA4497C85C5CA27290C555D]rawing::Size(284, 262); this->Name = L"Form1"; this->Text = L"Form1"; this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->ResumeLayout(false); } #pragma endregion private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { PCDLRN::ApplicationClass App; //this works, PC-DMIS opens App.Visible = true; //PC-Dmis is visible App.SetActive(); //Still no Error PCDLRN::ApplicationObjectEventsClass AppEvents; //COM ERROR 80040154 Class not registered } }; }
and again for VB
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim App As New PCDLRN.Application 'this works pc-dmis is open App.Visible = True 'pc-dmis is visible App.SetActive() 'no issue here Dim parts As New PCDLRN.PartPrograms 'COM Error 80040154 End Sub End Class
Hopefully someone will be able to help. Any of these languages will do.
Thanks in advance
btw i'm using PC-DMIS 2011 MR1 and Visual Studio 2010