I am trying to solve a problem, to display names of currently open windows.
I am using vc ++ (dialog-based apps).
GetWindow The API to go through the handle of the displayed windows. Use the The above code should work. If you only want a visible window, use the Update: An application that can be referred to GetWindow caught in an eternal loop or to destroy a window This task calls for execution of risk. Quoted from / P> GetWindowText API to get caption title (if it has one).
hwnd wnd = :: GetWindow (this-> GetSafeHWND (), GW_HWNDFIRST); If (! Wnd) {return; } CString csWindows = ""; Doing {CString csText; :: GetWindowText (wnd, csText.GetBuffer (MAX_PATH), MAX_PATH); CsText.ReleaseBuffer (); If (! CsText.IsEmpty ()) {csWindows + = csText + "\ n"; }} While (wnd = :: GetWindow (wnd, GW_HWNDNEXT)); Afs Message Box (CSWindo);
:: IsWindowVisible API to check it.
Comments
Post a Comment