Solved

Closing a program with only the task name

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

803 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