I'm working on an application frame using native C and win32 API. Writing handlers for placing an owned window inside the frame depending on user manipulation. So far I have:
case WM_WINDOWPOSCHANGED:
GetWindowRect(hwnd, &rect);
SetWindowPos(
hexp, HWND_TOP, rect.left + 5, rect.top + 30,
0, 0, SWP_SHOWWINDOW | SWP_NOSIZE );
It works great except I don't seem able to restore it from a minimized state. I've searched the forum and tried a couple of things with the SC_RESTORE handler including:
case SC_RESTORE:
ShowWindow(hwnd, SW_RESTORE);
SetForegroundWindow(hwnd);
BringWindowToTop(hwnd); // Doesn't work
I've also tried:
case SC_RESTORE:
SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); // no luck either
Nothing seems to work. I have to right click and choose restore when the application is minimized for now. Any clues would be most welcome.
** Update ** I found an improvement.
First of all not sure its a good idea to use the WM_WINDOWPOSCHANGED event to manipulate a lot of windows. The system seems to trigger that a lot. Also while I'm still using it I've decided to check if the window is minimized first. It seems the system was continuing to check for position changes while minimised. That's what apparently made the taskbar hang. It's working much better now thanks. Forcing things doesn't seem to be a good way to go about it either :/