   WinAPI: PostThreadMessage() issue with ShowWindow()
  I have a window with a message loop that receives messages from another thread via PostThreadMessage() to minimize itself, but every time the command is received and the ShowWindow(hWnd, SW_MINIMIZE) is called either the command is not removed from PeekMessage or the same command is added to the queue again resulting in an infinite loop. PeekMessage has the PM_REMOVE flag specified.I know this is a very specific problem but if anyone can help, please do!   
  I'm also running windows vista   ;  It also happens to PostMessage() when posting from different thread.   ;  What exactly are you trying to do with the window? ShowWindow() will post a WM_SHOWWINDOW message to the window, hence the infinite loop. To avoid it, maybe something like this might work for you:case WM_SHOWWINDOW:{    static BOOL bIgnore = FALSE;    if( bIgnore ) break;    if( wParam == 0 ) // Or whatever, depending on your goal.    {   bIgnore = TRUE;   ShowWindow( ... );   bIgnore = FALSE;   return 0;    }}break;;  I don't even process WM_SHOWWINDOW so that couldn't be it.What my app does is one thread sends a custom message (using PostThreadMessage()) to another thread that has contains a window. The custom message tells the thread with the window to call ShowWindow(hWnd, SW_MINIMIZE).   