Author Topic: DC not launching as usual  (Read 509 times)

Juergen

  • Jr. Member
  • **
  • Posts: 94
DC not launching as usual
« on: December 10, 2014, 12:17:44 PM »
This code is tested on about 20 machines:

Code: [Select]
       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

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4091
Re: DC not launching as usual
« Reply #1 on: December 10, 2014, 01:34:31 PM »
Try running those DesignCADs on the Win8 machine using "Run as Administrator" once, then see if they will launch from your code.
2016 marks my 24th year in DesignCAD-Land!

Juergen

  • Jr. Member
  • **
  • Posts: 94
Re: DC not launching as usual
« Reply #2 on: December 11, 2014, 01:04:33 AM »
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