hexagon logo

Got Visual Studio and the Interop.PCDLRN.dll... Now what?

As I upgraded one CMM to Windows 7 64-bit, my small VBS helpers died in the process (still kickin' butt on XP though).
So, I have begun re-coding them in Visual Studio 2010 (I think). I have gotten so far in the coding where I need to connect to PC-DMIS and start interfacing with it. Now, I managed to find the DLL that is supposed to expose some interfaces and methods and I have successfully added it to my project.

Then what? How do I use the DLL to connect to PC-DMIS and expose the PartPrograms collection for instance?

Oh, I am using C# for this...

Any and all input, examples or suggestions are VERY welcome!

TIA!
  • Hi Cappy,would you pls send me the help file "Windows 7 automation notes"?
    I need some c# demo for developping pcdmis.
    Thank you very much!


    There really isn't anything to send.

    the code to launch PC-DMIS is in the post you commented on...
  • IMO C# > VB.NET. yes it gets compiled the same, but there are certain aspects of C# that don't exist in VB.NET. LINQ for example is a huge time saver. I also never really liked the syntax of vb.net. C# is much closer to C/C++
  • resurrected this one.... this is my fav section of the forum.
  • Soon to be mine as well. Work is sending me to school for scripting.
  • I got a error message " PCDLRN.Application has no clsid" when I run my PCDMIS addon program. The code calls CoCreateInstance(__uuidof(PCDLRN::Application). How to register this (PCDLRN.Application CLSID)? Thanks in advanced
  • I got a error message " PCDLRN.Application has no clsid" when I run my PCDMIS addon program. The code calls CoCreateInstance(__uuidof(PCDLRN::Application). How to register this (PCDLRN.Application CLSID)? Thanks in advanced





  • i some how ended up back on this page, in the method "StartPCDMIS()", I noticed that i should have used a different command to check when PC-DMIS is ready... so here's the Edit:

    bool StartPCDMIS()
    {
    try
    {
    Type pcdObjType = Type.GetTypeFromProgID("PCDLRN.Application");
    this.pcdApp = Activator.CreateInstance(pcdObjType);
    
    int timeout = 100; // the number of seconds to wait...
    pcdApp.WaitUntilReady(timeout);
    
    
    return true; //pc-dmis started
    }
    catch
    {
    return false; // an error occured
    }
    }
    
    



    When I run these code snippets on the PC-DMIS machine, another instance of PC-DMIS Application is launched, and because we only have 1 seat, it fails with "Feature rejected (Terminal Server remote client not allowed). What is the code to test whether PC-DMIS is running, and connect to it if it is?
    Thks,
    z
  • This is from my "Search PC-DMIS programs" app:

    try
    {
    Type pcdObjType = Type.GetTypeFromProgID("PCDLRN.Application");
    PCDApp = Activator.CreateInstance(pcdObjType);
    string status = "";
    /*
    this while loop starts with status = "", and will query PC-DMIS for the text in the status bar at the bottom of the screen.
    when it finally says "READY" or it contains "DONE INIT", the loop will exit
    readystr and initstr is defined in the application settings
    */
    while (status != readystr && !status.Contains(initstr))
    {
    System.Threading.Thread.Sleep(1000); // give pc-dmis a second to work
    status = PCDApp.StatusBar();
    }
    PCDStarted = true; //PC-DMIS started
    }
    catch
    //catch (System.Runtime.InteropServices.COMException f)
    {
    PCDStarted = false; // PC-DMIS did not start
    //MessageBox.Show(string.Format("PC-DMIS måste vara startat: {0}", f.Message)); // PC-DMIS needs to be started!
    //System.Windows.Forms.Application.Exit(); // Exit
    }