Results 1 to 9 of 9

Thread: Please Help with this Code. My program is crashing when Unloading

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196

    Please Help with this Code. My program is crashing when Unloading

    I'm using a class module (in the zip file) called ctooltip.cls

    I have no other declarations, other than this function and the code inside the class module. My program terminates fine when the function below doesn't get called, but when I start the program with a commandline parameter the program crashes on termination every time. I figure that something isn't getting destroyed or set to = nothing etc...

    Any help would be greatly appreciated.

    VB Code:
    1. Private Function AnalyzeCommandLineParameters(cmd As String) As Boolean
    2.     '======================================================
    3.     '   Analyzes the CommandLine Parameters
    4.     '======================================================
    5.    
    6.     On Error GoTo ERR
    7.    
    8. With New CommandLineHelper
    9.    
    10.     .CommandString = cmd
    11.      
    12.     If .HasParameter("-P") Then
    13.        
    14.             '// Do stuff here
    15.        
    16.     End If
    17.    
    18. End With
    19.  
    20. Exit Function
    21. ERR:
    22.     MsgBox "Error In AnalyzeCommandLineParameters!" & vbCrLf & vbCrLf & ERR.Description, 64, App.Title
    23. End Function
    Attached Files Attached Files
    Brandon S Davids

  2. #2
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    brandoom

    What is CommandLineHelper? You never destroy it.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196
    I have tried to destroy it...


    set CommandLineHelper = Nothing


    It doesn't work
    Brandon S Davids

  4. #4
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    brandoom

    Let's try this again... What is CommandLineHelper?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196
    Oops.. my bad.. I attached the wrong file..

    Sorry, haven't slept in a long time.

    It references the Class File that I'm attaching now...

    Sorry...
    Attached Files Attached Files
    Brandon S Davids

  6. #6
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    brandoom

    Try it this way. You definitely had a memory leak.

  7. #7
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    If CommandLineHelper is the name of the class, why not try to use an object variable instead of trying to directly manipulate the instance in the With statement? You could use a code like this:

    VB Code:
    1. Dim obj As CommandLineHelper
    2. Set obj = New CommandLineHelper
    3. With obj
    4. 'Your code here ...
    5. 'Your code here ...
    6. End With
    7. Set obj = Nothing

    I think in the above code if you did miss the Set obj = Nothing, it wouldn't crash the program. But since you are trying to directly manipulate the new instance without assigning it to a variable, it might be crashing.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196

    FIXED!!! Edited!

    Sorry guys, after I tried both of your solutions, I figured that something else must be happening.

    I found that "m_col" was used in the class, and it was also being used in another module. I renamed the collection and everything worked fine.

    I've been coding for a year, and that's the first time that I've had a global scope error.


    Again, thanks for your time and fast response....

    ==================================

    I really appreciate your time, but it still isn't working for me.

    I've implemented all your changes and double checked, but I still have the same problem.

    Any other ideas?

    Originally posted by randem
    brandoom

    Try it this way. You definitely had a memory leak.
    Last edited by brandoom; Jan 4th, 2004 at 03:00 AM.
    Brandon S Davids

  9. #9
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385
    brandoom


    Without seeing the rest of the code... it's just a shot in the dark. You definitely should change any code that you had to the code format I changed it to. but other than that...?????

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