Skip to content

Commit

Permalink
fix the closing of Hider.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
setsumi committed Nov 24, 2023
1 parent beb883e commit 5acaadf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ HINSTANCE hInstance = NULL;
HHOOK hMouseHook = NULL, hKbdHook = NULL;
HCURSOR hCurBlank = NULL;
HWND hWindow = NULL;
bool FastTermination = false;

// ---------------------------------------------------------------------------
String GetWindowClassPlus(HWND hwnd)
Expand Down Expand Up @@ -321,11 +322,13 @@ static BOOL CALLBACK enumWindowCallback(HWND hWnd, LPARAM lparam)
if (!IsWindowVisible(hWnd))
ShowWindow(hWnd, SW_SHOW);
SetForegroundWindow(hWnd);
FastTermination = true;
exit(0); // Terminate myself
}
return TRUE;
}

// ---------------------------------------------------------------------------
void __fastcall TFormMousePuff1::FormCreate(TObject *Sender)
{
hInstance = (HINSTANCE)GetWindowLong(Handle, GWL_HINSTANCE);
Expand Down Expand Up @@ -374,10 +377,12 @@ void __fastcall TFormMousePuff1::FormDestroy(TObject *Sender)
Save();
MyShowCursor(true, true);
DestroyCursor(hCurBlank);
HWND hHider = FindWindow(LEASED_WNDCLASS, LEASED_WNDTITLE);
if (hHider)

if (!FastTermination)
{
PostMessage(hHider, WM_CLOSE, 0, 0);
HWND hHider = FindWindow(LEASED_WNDCLASS, LEASED_WNDTITLE);
if (hHider)
PostMessage(hHider, WM_CLOSE, 0, 0);
}
}

Expand Down

0 comments on commit 5acaadf

Please sign in to comment.