Solved

Closing a program with only the task name

Posted on 1998-09-29
3
215 Views
Last Modified: 2010-04-30
How do you force a program to close by only using the name of the program when hitting Ctrl+Alt+Del?
0
Comment
Question by:Evil_Sorcerer
3 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 1437270
I'm not sure what you're after here. If you press <CTRL/ALT/DEL> you can select the program by pressing the first letter of the program.
0
 

Author Comment

by:Evil_Sorcerer
ID: 1437271
Excuse me, maybe I didn't state the answer clearly, how to close it using the name with API
0
 
LVL 2

Accepted Solution

by:
shchuka earned 40 total points
ID: 1437272
You can use FindWindow() API and then CloseWindow() api:

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Declare Function CloseWindow Lib "user32" Alias "CloseWindow" (ByVal hwnd As Long) As Long

FindWindow needs window class name.  If you don't know what the class name is (it might depend on what language the program was written in), then you can use GetNextWindow() and GetWindowText() to iterate through open window until you find the one you need.  Once you get the hWnd of the window, simply issue

Call CloseWindow(hWnd) to terminate that application.

Hope this helps,
-Aleks.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question