// SimpleWindowClassDefinition.cpp // // Revision Log // // Date Who SAR Notes // ========== === ======= ===================================== // (c) Reliable Software, 1997, 98 // Bartosz Milewski, www.relisoft.com // 2001-10-22 mph Add functionality // // #include "SimpleWindowClassDefinition.h" #include "ResString.h" SimpleWindowClassDefinition::SimpleWindowClassDefinition(int resId, HINSTANCE hInst) : _hInstance(hInst) { rfc::ResString resStr(hInst, resId); _name = resStr; } HWND SimpleWindowClassDefinition::GetRunningWindow() { HWND hwnd = ::FindWindow(GetName(), 0); if (::IsWindow(hwnd)) { HWND hwndPopup = ::GetLastActivePopup(hwnd); if (::IsWindow(hwndPopup)) hwnd = hwndPopup; } else hwnd = 0; return hwnd; } BOOL SimpleWindowClassDefinition::UsePreviousInstance() { HWND hwndOther = GetRunningWindow(); if (hwndOther == 0) return FALSE; ::SetForegroundWindow(hwndOther); if (::IsIconic(hwndOther)) ::ShowWindow(hwndOther, SW_RESTORE); return TRUE; }