0

So, I'm using this for a game that starts as fullscreen. I first do this to make it window mode:

SetWindowLongPtr(pantalla, GWL_STYLE, WS_CAPTION | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SYSMENU);
SetWindowLongPtr(pantalla, GWL_EXSTYLE, WS_EX_WINDOWEDGE);
SetWindowPos(pantalla, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_SHOWWINDOW);

After that I want to be able to hide the window, and to do so I'm using this:

SetWindowLongPtr(pantalla, GWL_EXSTYLE, WS_EX_NOACTIVATE);
SetWindowPos(pantalla, HWND_BOTTOM, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);

That EX_NOACTIVATE was just a test, didn't work.

The problem is; the window hides perfectly, but then whenever I click (anywhere in the screen) the hidden program appears right back. How can I prevent that?

drescherjm
  • 8,907
  • 5
  • 42
  • 60
user1913644
  • 137
  • 1
  • 8
  • To hide a window you use `ShowWindow` func with `SW_HIDE` flag. – Jovibor Apr 29 '19 at 02:17
  • I tried that too, didn't work. – user1913644 Apr 29 '19 at 02:25
  • 1
    Check your code and find the place that is unhiding the window and then figure out why it's triggered. Hidden windows aren't unhiding by itself. – montonero Apr 29 '19 at 08:41
  • Hidden windows may be unhiding themselves if the author doesn't control the code. This smells like the code in the question is running in one process and the game is an unwilling victim in a different process. – David Heffernan Apr 29 '19 at 09:58
  • Check the code of handling `WM_LBUTTONDOWN`/`WM_WM_LBUTTONUP` or any other mouse event handles. – Drake Wu Apr 30 '19 at 06:57

0 Answers0