Results 1 to 6 of 6

Thread: Close Program

  1. #1

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604

    Exclamation

    hi,

    i know how to run a program using the shell line, but i am writing a program that shuts your computer down, after an alloted time, but i want to close winap first, what code do i use to close it.

    Thanks

    Merlin ?

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'bas module code
    
    Public Declare Function ExitWindowsEx Lib "user32" _
    (ByVal uflags As Long, ByVal dwReserved As Long) As Long
    
    Public Const EXIT_LOGOFF = 0
    Public Const EXIT_SHUTDOWN = 1
    Public Const EXIT_REBOOT = 2
    
    'shutdown windows
    
    Public Sub ShutDown(uflags As Long)
         Call ExitWindowsEx(uflags, 0)
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    To close Winamp:

    Code:
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Const WM_CLOSE = &H10
    
    Private Sub Command1_Click()
    
        'Get the handle of Winamp
        Retval = FindWindow(0&, "Winamp 2.5e")
        'Close Winamp
        SendMessage Retval, WM_CLOSE, 0&, 0&
        
    End Sub

  4. #4

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    hi,

    thanks for the info, but all this does is shutdown windows, i want to close the program first, if not i shall write my own mp3 player, do u have any infor on making one

    Cheers

    Merlin ?

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    sorry, I figured if you close windows, windows will close winamp...

    Megatron has supplied code to kill winamp.

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  6. #6
    Guest
    If you would like information on building your own MP3 player, see this link.

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