Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing a task

Status
Not open for further replies.

stefanschermann

Programmer
Nov 27, 2001
5
NL
How can you close a task programmatically if you only know the name displyed when you press Ctrl+Alt+Del?
 
Hi,
I'm not really sure what you mean by a task.

If you mean a process you can use the ExitProcess() function.

Commonly this is used subsequent to a error check such as
if (test)
{ DWORD gle = GetLastError();
sprintf(emsg,"\n Fatal Application Error : %d\n",gle);
ExitProcess(gle);
}

Similarly if you want to kill a thread you could do something like :

LPDWORD exitcode;
DWORD gle;
GetExitCodeThread(threadhandle,&exitcode) ?
ExitThread(exitcode) : GetLastError(gle);

Hope this helps ;-)
 
I think what he wants to do is to close ONE task using ANOTHER task.
"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
As far as I know ( and I could well be wrong ) you can only close a seperate task from another program if you have set up both apps or there is a built in interface in the second program for doing this.

The method as I understand is for the first app to query the Windows Global Atom to verify existence of the other application and then to initiate a DDE conversation in order to close it.

There is almost certainly another way to do the same thing regardless of the application but I've never come across it.
 
Another thought - If you can get the applications window handle PostQuitMessage() or SendMessage() with WM_CLOSE might do the trick.

I think it depends on the app though - things like firewalls etc tend to take steps to avoid being remotely closed (for obvious reasons)..
 
I think this is my lucky day!! (again)

I am a member at the VFP forum and this is my first question in this forum. Any help will be helpful.

Because of some special features in the xcopy/xcopy32 DOS command, I use it in one backup application. I was able to run the command in the way I wanted (Using WinExec api function). Since it's a command I use to copy the contents on several folders I'm forced to do many calls through the WinExec, one for each directory. The problem I haven't been able to solve is that in Win98 every time I run it, a copy of WinOldAp is created and left on memory (I suppose, because if I press CTRL+ALT+DEL I can see a list of WinOldAp, one for each folder).

Of course, I could go to CTRL+ALT+DEL and "END TASK" each one manually, which is imposible because the application is running in a dedicated machine and runs twice a day automatically, meaning there is no user interaction with the application.

Is there a way to end the processes using API calls?

Thank you all

Rianeiro Miron
rianeiromiron@yahoo.com
 
Has this ever been resolved on how to programmatically close the winoldap? Christopher F. Neumann
[dBASE Charter Member]
Blue Star Visual dBASE graduate
ICCP certified TCP/IP Network Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top