Return to the previous active window?
-
Hi all, I have a dialog that pops up every hour or so, and I'd like it to return to the previous active window after the user clicks OK on the dialog. I've got a HWND member variable that gets the previous active window in PreCreateWindow, and a SetActiveWindow function in the PostNcDestroy of the popup dialog class. I'm not sure about where else to put these functions, --and it does bomb with an error, "...memory could not be read." Could someone point me in the right direction? Where's the best place to do this? Thanks in advance. Matt
-
Hi all, I have a dialog that pops up every hour or so, and I'd like it to return to the previous active window after the user clicks OK on the dialog. I've got a HWND member variable that gets the previous active window in PreCreateWindow, and a SetActiveWindow function in the PostNcDestroy of the popup dialog class. I'm not sure about where else to put these functions, --and it does bomb with an error, "...memory could not be read." Could someone point me in the right direction? Where's the best place to do this? Thanks in advance. Matt
Found that
::SetForegroundWindow(hwnd);
seems to work. Just didn't look deep enough. Sometimes things are staring you right in the face and you don't even realize it. :mad: Matt