Solved

Closing a program with only the task name

Posted on 1998-09-29
3
224 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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