Solved

Closing a program with only the task name

Posted on 1998-09-29
3
188 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now