Bonjour à tous,
je connais le HWND d'une fenêtre et je désire savoir si ce HANDLE appartient à un process dont je connais le nom.
Mais ma méthode statique IsClient me retourne tout le temps false.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 struct Struct { HWND Handle; bool Test; }; bool CALLBACK EnumWindowsProc(HWND hWnd, Struct *Test) { if (hWnd == Test->Handle) Test->Test = true; return (TRUE); } bool Test::IsClient(HWND Handle, String Title) { HANDLE hSnapShot; PROCESSENTRY32 pe; hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (Process32First(hSnapShot, &pe)) { do { if (pe.szExeFile == "firefox.exe") { HANDLE Process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID); CloseHandle(hSnapShot); Struct Str; Str.Handle = Handle; Str.Test = false; EnumChildWindows((HWND)Process, (WNDENUMPROC)EnumWindowsProc, (LPARAM)&Str); return (Str.Test); } } while (Process32Next(hSnapShot, &pe)); } CloseHandle(hSnapShot); return (false); }
Si quelqu'un a une idée...
Merci d'avance.
Cordialement,
NeoKript
Partager