Terminate Process On Close?

Discussion in 'Programming General' started by 0h n035, Mar 17, 2008.

Terminate Process On Close?
  1. Unread #1 - Mar 17, 2008 at 2:02 AM
  2. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    Terminate Process On Close?

    Okay. I have My Splash Screen:

    Code:
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Const HWND_TOPMOST = -1
    
    Private Sub Form_Load()
      Dim TempValue As Long
      Dim MyWidth As Long, MyHeight As Long
      Dim MyTop As Long, MyLeft As Long
      
      MyWidth = 430
      MyHeight = 205
      
      MyLeft = Screen.Width / (4 * Screen.TwipsPerPixelX)
      MyTop = Screen.Height / (4 * Screen.TwipsPerPixelY)
    'Call SetWindowPos API function
      TempValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, MyLeft, MyTop, MyWidth, MyHeight, SWP_SHOWWINDOW)
    End Sub
    
    Private Sub Timer1_Timer()
    Me.Cls
    Splash.Cls
    Unload Me
    Unload Splash
    Main.Show
    Timer1.Enabled = False
    End Sub
    
    It seems to only hide when the timer reaches zero. I want it so that it actually CLOSES or so that when I close the Main Form (Main.frm) it closes/terminates everything to do with the Program.

    Thanks, 0h N035
     
  3. Unread #2 - Mar 17, 2008 at 3:27 AM
  4. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    Terminate Process On Close?

    :(

    Bad way:
    Code:
    End
    Good way:
    Code:
        Dim frm As Form
        For Each frm In Forms
            Unload frm
        Next frm

     
  5. Unread #3 - Mar 17, 2008 at 3:39 AM
  6. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    Terminate Process On Close?

    I don't even have End XD

    I've tried End and what you gave me but nothing will work. I Exit out of my client yet it still runs in my processes.
     
  7. Unread #4 - Mar 17, 2008 at 3:44 AM
  8. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    Terminate Process On Close?

    How do you exit out of your client?
    Would you mind contacting me on MSN?
     
  9. Unread #5 - Mar 17, 2008 at 3:49 AM
  10. 0h n035
    Joined:
    Feb 1, 2007
    Posts:
    163
    Referrals:
    0
    Sythe Gold:
    0

    0h n035 Active Member

    Terminate Process On Close?

    Nevermind, fixed :D

    For some reason, this worked:

    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    On Error Resume Next
    Dim retval As Integer
        retval = MsgBox("You should make sure you're disconnected from Runescape before closing the client. Do you want to exit?", vbQuestion + vbYesNo, "Exit ShadowClient?")
        If retval = vbNo Then
            Cancel = 1
            Exit Sub
        End If
        End
    End Sub
    Just 'End' or Unload Form, etc never worked before.
     
  11. Unread #6 - Mar 17, 2008 at 7:01 AM
  12. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Terminate Process On Close?

    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        if MsgBox("You should make sure you're disconnected from Runescape before closing the client. Do you want to exit?", vbQuestion + vbYesNo, "Exit ShadowClient?") = vbyes then
            dim frm as form
            for each frm in forms
                 if lcase(me.name) <> lcase(frm.name) then
                     unload frm
                 end if
            next frm
            unload me
        else
            cancel = 1
        end if
    End Sub
    Also you should really have a second look at that code on your splash screen and make it a little more effecient.
     
< help making a "eliteshift" | Code thus not work as expected. HELP >

Users viewing this thread
1 guest


 
 
Adblock breaks this site