Results 1 to 11 of 11

Thread: Killing Program [Sort of resolved, anything better?]

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    8

    Question Killing Program [Sort of resolved, anything better?]

    I am building a program that has the ability to update itself by checking the current version of itself with an internet appserver, and then opening an OLE automated version of internet explorer in a new window before shutting itself down so the update can proceed.

    Unfortunately, the program can't be unloaded because after the forms are all unloaded when control is returned from the Class Module, the forms refuse to close and remain open.

    Is there any way to forcibly terminate the app? Thanks for the help.
    Last edited by AngelOfDeath69; Nov 3rd, 2002 at 09:15 PM.

  2. #2
    Hyperactive Member Q_Me's Avatar
    Join Date
    Dec 2001
    Posts
    327
    Well you can do it the noncomplicated way.

    VB Code:
    1. Private Sub Form_Unload() '<--It is an event yes, but it does not do its "cause" very well.
    2. Unload Me
    3. Unload frmYourForm1
    4. Unload frmYourForm2
    5. 'Unload Blah Blah.
    6.  
    7. End Sub
    53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.


  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    8

    Exclamation Doesn't Work

    Well, interesting (and predictable) suggestion, but I forgot to mention that after asking the forms to unload they reload themselves.

    This generally means that there is no way to do use the unload method on all the forms to quit the program. Sorry, I forgot to mention that!

  4. #4
    Hyperactive Member Q_Me's Avatar
    Join Date
    Dec 2001
    Posts
    327
    Meaning you wanted the forms to reload themselves?
    53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.


  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    8

    No.

    No, I don't want the blasted forms to reload. I want the program to die so I can overwrite it...


  6. #6
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857
    I 'm not really sure I understand . . .

    but you need to terminate your class before you unload your forms

    VB Code:
    1. 'you created your class instance as some point
    2. Dim classinstance As yourclassmodule
    3.  
    4.  
    5. 'you need to terminate this class
    6. Set classinstance = Nothing
    7.  
    8. 'then unload all forms

    I hope I am understanding you correct . . .
    "Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!

    Resistance is futile, you will be compiled . . . Please!

  7. #7
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    calling anything of the form will reload the form, so make sure that you are not doing that, even something like

    If Form1.Visible = True Then

    will reload form1
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  8. #8

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    8
    Thanks, but due to the nature of the Class Module, which is to say, I don't create it, it's internal to my application and completely public.

    I can't terminate it that way. I'll have a look in case I'm missing something like that but I don't think so.

    By the way, the only calls I'm making to the other forms, is "Unload", so they should not be reloading at all.

    Thanks for the help people. But is there a Windows API Call to destroy my instance of the application? I don't need to gracefully terminate it because it finishes all it's tasks before beginning the download.

  9. #9
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    A different approach....

    Create a loader program. This loader program checks a registry value to see if it should download. Complete the download and replace the EXE that is not even loaded into memory. Load your program as usual.

    From your current app, instead of downloading, just set the flag in the registry and tell the user to shut down the application and restart it.

    Hope this helps,

  10. #10
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476
    I think you are going to need a loader app.
    This would be a second application that looks at the version of the main app and goes and gets the new one if it's needed. It hen starts the main app with a shell command kills itself.

    FW

  11. #11

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    8
    Thanks, it's probably the best idea I'll get. Damn, it's inconvenient though.

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