Launching DC V24 by OLE

Started by Juergen, February 15, 2015, 06:31:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Juergen

  Launching DC 24 with

        On Error Resume Next
        DcApp = GetObject(,"DesignCAD.Application")
        If DcApp Is Nothing Then
            DcApp = New DesignCAD.Application
        End If
      
fails, DC V23 is launched.

I have tried Dcad24 /regserver and running once as administrator. Dcd files
are assigned to V24, this works (but not lauching by OLE).

Renaming dcad23.exe helps.

This is also fine:

        If DcApp Is Nothing Then
            Dim SubKey As String = "DesignCAD.DCD-Document.24\shell\open\command"
            Dim rk As RegistryKey = Registry.ClassesRoot.OpenSubKey(SubKey)
            Dim DcPath As String = CType(rk.GetValue("", ""), String)
            Dim DcPath2 = DcPath.Remove(DcPath.Length - 3, 3)
            Process.Start(DcPath2)
            Thread.Sleep(2500)
            DcApp = GetObject(, "DesignCAD.Application")
        End If
      
I guess this is a matter of the registry.
Does someone know a better solution?

Kind regards,

Juergen

Juergen

#1
I just noticed the problem only happens in case V23 is installed.
On another machine with DC21 and DC22 DesignCAD V24 is launched as expected.

May be V23 and V24 have the same GUID?

Juergen

DrollTroll

Did you try running dcad24 /regserver in an Administrator-elevated command prompt?

To change the current COM settings, DesignCAD needs admin-level access to HKLM. This requires an admin-level command prompt (even if you're running on an Admin account). Thanks Microsoft!
25 years with DesignCAD

Juergen

DT thanks!

Administrator-elevated command prompt are the magic words.  ;D

Kind regards,

Juergen

bpa

DcApp = GetObject(, "DcadExp25.Application")
If DcApp Is Nothing Then
   DcApp = New DcadExp25.Application
End If

First line seems not to work with DesignCAD 2V ver. 25
If Designcad i allready opened the line DcApp = New DcadExp25.Application seem to activate the open DesignCAD.
After closing the application and running again the line DcApp = New DcadExp25.Application will not activate the open DesignCAD but will open a new one. How can that be solved?

DrollTroll

Always be sure once you've done GetObject or New to set DcApp.Visible=True.


Example code below has one button to open a new instance, and another to connect to a running instance.





    Private Sub NewBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewBtn.Click
        DCApp = Nothing
        DCApp = CreateObject("DesignCAD.Application") 'New DesignCAD.Application
        DCApp.Visible = True
        MessageBox.Show("New instance of DesignCAD")
    End Sub


    Private Sub ConnectBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConnectBtn.Click
        DCApp = Nothing
        DCApp = GetObject(, "DesignCAD.Application")
        DCApp.Visible = True
        MessageBox.Show("Running instance of DesignCAD")
    End Sub
25 years with DesignCAD