I'm unable to restore a window after "minimizing" a window to tray, by doing this in wndproc:
case WM_SIZE:
if (wparam==SIZE_MINIMIZED) {
ShowWindow(hwnd,SW_HIDE);
}
break;
The tray message handler looks like this:
case TRAY_ICON_MESSAGE:
switch(lparam) {
case WM_LBUTTONDOWN:
ShowWindow(hwnd, SW_RESTORE);
BringWindowToTop(hwnd);
SetFocus(hwnd);
break;
// ...
The window does re-appear, but is always hidden beneath other windows and doesn't come to the top. Neither SetFocus() nor BringWindowToTop() appear to have any effect.