Merci pour cela, à la fin j'ai utilisé une version modifyed code Neftali's, j'ai inclus ci-dessous dans le cas où quelqu'un d'autre a les mêmes problèmes à l'avenir.
FindWindow(PChar('notepad'), nil);
était toujours 0 retournaient, donc tout en cherchant une raison pour laquelle j'ai trouvé this function qui trouverait le hwnd, et qui a travaillé un régal.
function FindWindowByTitle(WindowTitle: string): Hwnd;
var
NextHandle: Hwnd;
NextTitle: array[0..260] of char;
begin
// Get the first window
NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST);
while NextHandle > 0 do
begin
// retrieve its text
GetWindowText(NextHandle, NextTitle, 255);
if Pos(WindowTitle, StrPas(NextTitle)) <> 0 then
begin
Result := NextHandle;
Exit;
end
else
// Get the next window
NextHandle := GetWindow(NextHandle, GW_HWNDNEXT);
end;
Result := 0;
end;
procedure hideExWindow()
var Indicador:Hwnd;
begin
// Find the window by Classname
Indicador := FindWindowByTitle('MyApp');
// if finded
if (Indicador <> 0) then
begin
// Minimize
ShowWindow(Indicador,SW_HIDE); //SW_MINIMIZE
end;
end;
J'ai voté pour vous, comme vous me mettez sur la bonne voie, mais à la fin j'ai utilisé le code de Neftali – Re0sless