Force close application in Windows CE using C ++

How can I make an application, say myapp.exe, close using C ++ in Windows CE from another application?

The scenario is that I have a previous installation of some software that does not behave properly when upgrading to a new version. Therefore, I have to kill the process (from upgrade) to continue the upgrade.

+3
source share
3 answers

TerminateProcess? ( MSDN )

BOOL TerminateProcess( HANDLE hProcess, 
                       DWORD uExitCode );

HANDLE , API Toolhelp32. .

+2

, ExitProcess , TerminateProcess. ExitProcess , TerminateProcess . ExitProcess:

VOID ExitProcess(
  UINT uExitCode
);

this.

, .

0

, , - WM_QUIT, , . WM_QUIT . .

If this fails (and only after its failure), you can use the toolhelp API to search for the process (create a snapshot using NOHEAPS, then iterate to find it using First / Next calls) and terminate it using T erminateProcess .

0
source

Source: https://habr.com/ru/post/1756894/


All Articles