Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling minimized programs

I need help handling minimized programs when using a custom/self made explorer.exe file .. because unless properly handled, minimized programs will just shrink to something like 100x50px and stay on screen. I worked out a Timer in C# to check for "iconic" processes, list their mainWindowHandler, and move them outside the screen with "MoveWindow". To bring them back I use the handler and the "ShowWindow" function wich works AWESOME .. but as I said, it involves a constantly running Timer, so there must be a cleaner/easier way of achieving this.

Any ideas? Some way to hook and raise an event when a window is minimized?

*please note: show and movewindow are functions from user32.dll. I'm not trying to catch when MY forms are minimized, but when the OTHERS programs are.

like image 436
Nicolás Hurtado Avatar asked Nov 14 '22 08:11

Nicolás Hurtado


1 Answers

You can create a hook to check when windows are being minimized.

I found a CodeProject article that uses hooks to check when the user opens a system menu (ALT+SPACE) on any window, and then appends an extra item to it. You can use that code to check when the user hits the minimize button, and run whatever code you need there.

The CodeProject article is written in C++, but you can adapt the same method for C# (or use P/Invoke).

like image 74
Ove Avatar answered Nov 16 '22 03:11

Ove