Results 1 to 7 of 7

Thread: [RESOLVED] Debug advice needed

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    524

    Resolved [RESOLVED] Debug advice needed

    Hi all,

    I have a program that installed fine on hundreds of different PCs.
    And runs fine of course.
    No issue since years.

    But now I have a PC where the program installs but doesn't run.
    No error message, in the event manager just 'Doesn't work' and no hint where to look at.

    The program itself starts from Sub Main, there is InitCommonControls etc.
    Then it loads the main form.

    I modified the program to write a debug file.
    In every 2nd line of the source this kicks in.

    It stops working just before Load frm_Main.
    So no further output...

    Only standard OCXs are used (COMCTL32.OCX etc.).

    And yes, all the satellite files are there for the program.
    This all is double and triple checked.

    ---

    Any idea how to debug further?

    Thanks,
    Karl

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Debug advice needed

    Are there any differences with this new PC and the other, working PCs? Operating System, 32 / 64 bit, installed updates etc. If you wrap the Load frm_Main in an error handler does the error message give you any information?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    524

    Re: Debug advice needed

    Are there any differences with this new PC and the other, working PCs? Operating System, 32 / 64 bit, installed updates etc.
    Sure there are differences.
    But nothing special in this case.
    In fact the unwilling PC is quite similar to the one I work on.

    If you wrap the Load frm_Main in an error handler does the error message give you any information?
    The error handler is of course there.
    But as the form doesn't load, it can't do anything for me.
    That's the problem...

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Debug advice needed

    Does it use a manifest? If so, can you send them a test setup without one and starts with main form, not Sub Main. If it works, you likely narrowed the problem down: manifest or the Sub Main initialization of Shell32. If your test setup works in this scenario and you need more help, you'll probably need to show us your Sub Main and manifest. If it still fails to load, at least one more potential issue was eliminated. Good luck.

    Edited:
    If you wrap the Load frm_Main in an error handler does the error message give you any information?
    Maybe the question better asked: Is the 1st line of Form_Load (or Form_Initialize if used), a statement that writes to file? If so, and nothing is written, then it does kinda limit it to Sub Main, project references, and/or failed dependency registration I'd think.

    You might want to get the exact wording of the Windows event log entry too.
    Last edited by LaVolpe; Aug 21st, 2017 at 07:08 AM. Reason: typo
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: Debug advice needed

    I use MZTools to add error templates to the routines.
    Example of a basic forms:
    Code:
    Option Explicit
    
    Private Sub Form_Initialize()
    
      On Error GoTo Proc_Error
      DebugLog ">> Sub Form_Initialize() of Form Form1"
    
      ' Code
    
      GoTo Proc_Finish
    
    Proc_Error:
      DebugLog "Error: " & Err.Number & " on line: " & Erl & vbLf & _
               "Description: " & Err.Description & vbLf & _
               "in Sub Form_Initialize() of Form Form1", True
    
    Proc_Finish:
      DebugLog "<< Sub Form_Initialize() of Form Form1"
      On Error GoTo 0
    End Sub
    
    Private Sub Form_Load()
      On Error GoTo Proc_Error
      DebugLog ">> Sub Form_Load() of Form Form1"
    
      ' Code  
    
      GoTo Proc_Finish
    
    Proc_Error:
      DebugLog "Error: " & Err.Number & " on line: " & Erl & vbLf & _
               "Description: " & Err.Description & vbLf & _
               "in Sub Form_Load() of Form Form1", True
    
    Proc_Finish:
      DebugLog "<< Sub Form_Load() of Form Form1"
      On Error GoTo 0
    End Sub
    
    Private Sub Form_Paint()
      On Error GoTo Proc_Error
      DebugLog ">> Sub Form_Paint() of Form Form1"
    
        ' Code
    
      GoTo Proc_Finish
    
    Proc_Error:
      DebugLog "Error: " & Err.Number & " on line: " & Erl & vbLf & _
               "Description: " & Err.Description & vbLf & _
               "in Sub Form_Paint() of Form Form1", True
    
    Proc_Finish:
      DebugLog "<< Sub Form_Paint() of Form Form1"
      On Error GoTo 0
    End Sub
    In a module:
    Code:
    Public Sub DebugLog(sMessage As String, Optional ByRef bShow As Boolean)
      Dim fID As Integer
      Dim bPrint As Boolean
      Dim aMessage() As String, i As Long
      
      bPrint = Len(g_sErrorLog) > 0
      
      If bPrint Then
        On Error Resume Next
        fID = FreeFile
        Open g_sErrorLog For Append As fID
        If InStr(1, sMessage, vbCrLf) > 0 Then
          aMessage = Split(sMessage, vbCrLf)
          For i = 0 To UBound(aMessage)
            Print #fID, Time & " - " & aMessage(i)
          Next i
        Else
          Print #fID, Time & " - " & sMessage
        End If
        Close #fID
      End If
      
      If bShow Then MsgBox sMessage, vbCritical
      Debug.Print Timer, sMessage
    End Sub

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    524

    Re: Debug advice needed

    @Arnoutdv

    I use MZTools to add error templates to the routines.
    I don't, but my routine is practically the same.
    Except it writes always into a file on the Desktop (which works, I get the output before not loading the main form.)

    ---

    @LaVolpe

    Does it use a manifest?
    Sure, an internal one.

    If so, can you send them a test setup without one and starts with main form, not Sub Main.
    I'll give that a try.
    I will know more tomorrow in the evening then.

    Thanks for all your tips.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    524

    Re: Debug advice needed

    Found the issue!
    Of course it was my fault.
    It was a long journey, I had to set up a fresh PC in order to be able to retrace the issue.

    Recently I changed the setup script (Inno), and accidently commented out the install of COMCTL32.OCX.
    I meant to comment out MSVBM60.DLL.
    Now I made a quick Patch installer, and all is good now again.

    BUT:
    I still wonder why I didn't get a runtime error.
    The program was in the task manager, and used some CPU.
    Also no real info in the event viewer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width