I have a simple winforms application in VB.NET 2008. I am using a form with a completely custom look, so there is no title bar, thus no minimize, maximize, and close buttons. I've created custom controls to replace those.

If I have my app running, and I click the 'Show Desktop' shortcut, all the programs minimize properly, including mine. But, if I use the Windows + M shortcut, all the programs EXCEPT mine minimize. It seems that the lack of the built-in minimize button on the form causes my app to ignore Windows + M.

How can I detect Windows + M, especially if my app is not active, or how can I duplicate the functionality of the built-in Minimize button?

EDIT:

I've tried implementing the following code, with no success.

Const WM_SIZE As Integer = &H5
Const SIZE_MINIMIZED As Integer = &H1

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
  MyBase.WndProc(m)

  If m.Msg = WM_SIZE Then
     If m.WParam = SIZE_MINIMIZED Then
        //Minimize the form.
        Me.WindowState = FormWindowState.Minimized
     End If

  End If
End Sub

This seems like the right approach (thanks to SLaks), but my app doesn't seem to be receiving any messages from Windows + M. Or, more likely, I'm not intercepting them properly.

EDIT:

I've checked out the messages that my app is receiving with Spy++ (thanks again SLaks) and it looks like the WM_SIZE message is not getting sent to my app. I tried a regular winforms app with the standard title bar and buttons, and it receives the WM_SIZE message as expected when Windows + M is pressed. Somehow the lack of a title bar is preventing the WM_SIZE message from being received in my custom form's WndProc.

EDIT:

Edit
Report