DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

DC not launching as usual

Started by Juergen, December 10, 2014, 12:17:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Juergen

This code is tested on about 20 machines:

       DcApp = Nothing

        On Error Resume Next
        DcApp = GetObject(, "DesignCAD.Application")
        '  MsgBox("DC was launched before")
        If DcApp Is Nothing Then
        DcApp = New DesignCAD.Application
            '    MsgBox("DC launched")
        End If
        If DcApp Is Nothing Then ' The hard way --- should work V>21
            Dim SubKey As String = "DesignCAD.Document\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
        If DcApp Is Nothing Then ' The hard way -- V23
            Dim SubKey As String = "DesignCAD.DCD-Document.23\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
        If DcApp Is Nothing Then ' The hard way -- V22
            Dim SubKey As String = "DesignCAD.DCD-Document.22\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
        If DcApp Is Nothing Then ' The hard way -- V21 (min version)
            Dim SubKey As String = "DesignCAD.DCD-Document.21\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
        If DcApp Is Nothing Then ' The hard way -- other entry
            Dim SubKey As String = "DesignCAD.DCD-Document\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 - 5, 5)
            Process.Start(DcPath2)
            Thread.Sleep(2500)
            DcApp = GetObject(, "DesignCAD.Application")
        End If


        If DcApp Is Nothing Then
            MessageBox.Show(Me, "And now ???", "DC not launching",
            MessageBoxButtons.OK, MessageBoxIcon.Error)
            Close()
            Exit Sub
        End If

        Dim DcVersion As String
        DcVersion = DcApp.ProgramVersion
        MessageBox.Show(Me, "DesignCAD Version: " & DcVersion, "DC-Version", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)


and DC is launching as expected. On one installation
on a WIN 8 machine( multiple DC installs V22, V23 and an older
(presumably) V17) this routine fails - DC is not launching.

Can I do more to ensure DC launching?

Kind regards,

Juergen

DrollTroll

Try running those DesignCADs on the Win8 machine using "Run as Administrator" once, then see if they will launch from your code.
25 years with DesignCAD

Juergen

Unfortunately I don't have access to this system.
Running DC as administrator was done before without success.

But:

After changing the order of the call attempts this conspicuous
machine decided to launch.
Welcome to the next trouble... ;)

Thanks,

Juergen