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 ?
Printable View
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 ?
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
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
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 ?
sorry, I figured if you close windows, windows will close winamp...
Megatron has supplied code to kill winamp.
If you would like information on building your own MP3 player, see this link.