Click to See Complete Forum and Search --> : closing a program
DiGiTaIErRoR
Jan 22nd, 2000, 09:58 AM
Easiest way of putting this is like the Control+Alt+Delete menu where you can 'End Task' a program I want to do this same thing in VB.
Thanks in advance.
------------------
DiGiTaIErRoR
cjwares
Jan 22nd, 2000, 04:36 PM
well, this is the only way i know how to do it.
appactivate "[the program's caption]"
sendkeys "%{F4}", true
hope it helps :)
------------------
Charlie Jacquez
16 Year Old Software Developer
Email: cjwares@hotmail.com
Web: CJWARES Online (http://www.geocities.com/cjwares)
AIM: CJWARES, SlimmShadee2000, or BIOSzapper
ICQ: 58493454
I program: Basic, Visual Basic, HTML, and TI-Calculators
My System Specs: Click here (http://www.geocities.com/SiliconValley/Office/4476/myspecs.htm)
DiGiTaIErRoR
Jan 22nd, 2000, 04:53 PM
I need more of a way to 'force it'.
------------------
DiGiTaIErRoR
Jhd.Honza
Jan 22nd, 2000, 06:21 PM
There are two ways to force an application.
At first, try
Const NILL = 0&
Const WM_SYSCOMMAND = &H112
Const SC_CLOSE = &HF060
lpClassName$ = "SciCalc"
lpCaption$ = "Calculator"
'* Determine the handle to the Calculator window.
Handle = FindWindow(lpClassName$, lpCaption$)
'* Post a message to Calc to end it's existence.
X& = SendMessage(Handle, WM_SYSCOMMAND, SC_CLOSE, NILL)
' Enter each of the following Declare statements on one, single line:
Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any,
ByVal lpCaption As Any)
Declare Function SendMessage& Lib "user" (ByVal hwnd%, ByVal wMsg%,
ByVal wParam%, ByVal lParam As Long)
----------------remarks: if you don't know the ClassName, use vbNullString-----------
I can't find the second method at the moment, I will look up and write you.
PS: There is a small group of programs (e.g. Acces) that won't end.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.