uchwyt

0

Jak uzyskać informacje dotyczące programu mająć uchwyt jego okna.
Jak zabić program mająć uchwyt ale tylko okna tegoż programu.

0

DWORD GetWindowThreadProcessId(

HWND hWnd,	* handle of window
LPDWORD lpdwProcessId 	* address of variable for process identifier

);
hWnd - Identifies the window.

lpdwProcessId - Points to a 32-bit value that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the 32-bit value; otherwise, it does not.

  • zwraca id watku ktory stworzyl okno
  • id procesu dostaje lpdwProcessid(jeli podasz)

teraz

HANDLE hProc=OpenProcess(PROCESS_TERMINATE,false,idProcesu);
TerminateProcess(hProc,-1);
Closehandle(hProc);

ale to metoda "na twardo"

chyba lepiej to zrobic wysylajac quit'a - aplikacja moze sie usunac sama

PostMessage(hWnd,WM_QUIT,-1,0);

1 użytkowników online, w tym zalogowanych: 0, gości: 1