I got the following problem. For an application that I have already up and running I wrote something like an observer program. The observer simply checks from time to time if the application is still alive and responding. If that is, for whatever reason, no the case, the observer kills the application process (TerminateProcess()) and starts another instance.
Now that works quite well so far. Only when a windows error report or such something pops up in the trail of an application crash, the observer is unable to kill the application. So the whole mechanism breaks down.
My question is, is there a possibility to kill an application nonetheless? Or to find out what is blocking the killing and to kill that one first then?
I could get all the possible process names of the processes that might show up, but that will always leave a hole in the system.
First and foremost: never use TerminateProcess to terminate your application, there should be a better method.
If you nonetheless want, at extreme stage, to kill unconditionally the application then use TerminateProcess (rules are there to be broken... ): as suggested by David, there's no worst hammer than such a function (AFAIK).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
Check the return value of TerminateProcess() and get the error code, if any, using GetLastError().
Is the application and observer running in different user contexts?
If so GetLastError should return Access Denied(5).
«_Superman_» I love work. It gives me something to do between weekends.
Hey, I'm using Windows Hook, I installed the mouse hook, system-wide and its working perfectly. Now there is a problem, I need to the get window handle on which the mouse was clicked.. How do I do that? Does the Mouse hook event passes us that information?
Hmmm. But I ran into another problem. Since I only needed Desktop's ListView (SysListView32) mouse events. I used WH_MOUSE because it can be thread specific whereas WH_MOUSE_LL can be global hook only that's why.
Now when I did this change, I'm not getting any events when I click on the desktop icons or anywhere in the desktop.
I am writing a C++ application using Win32 API (i.e. no MFC, no .NET). I want to process some major messages such as WM_PAINT, WM_MOUSEMOVE, and WM_CHAR in the dialog procedure (let's call it DialogProc). The dialog is created using DialogBox or DialogBoxIndirect in some cases, and DialogProc is passed as the fourth argument to DialogBox. My problem is these aforementioned messages (WM_PAINT etc.) are not passed to DialogProc. Is there any way to catch and handle these messages in a dialog box procedure? or do I have to create a dialog box using RegisterClass and CreateWindow? I appreciate your help.
On Mac OS there is a command called "CreateWindowGroup" which allows you to group two or more windows together. These windows move, minimize and maximize as a single unit. I am looking for something similar for Windows. I am coding in C++
Does Windows have something like this built in or would I need to roll my own?
The plugin I wrote on the Mac has this feature (part of the OS) and someone had requested this feature for Windows and seeing as I am starting the Windows version of the plugin I thought I would try to tackle it but it seems like I may need to wait for this feature..