Board index » cppbuilder » Dual monitors. Minimize all window from one of them
Star
![]() CBuilder Developer |
Star
![]() CBuilder Developer |
Dual monitors. Minimize all window from one of them2007-02-01 06:56:11 AM cppbuilder38 Hi, I'm trying to write a small program that can minimizes all the tasks that are in the task manager but only for one of the monitors that I have. (I have 2 monitors using extended desktop) What I need basically is the what Show desktop does, but instead of doing it for all the windows in every monitor, just for one. Is that possible? I have tried using Enumwindows, but I get a huge list of windows and not the ones that are in the taskbar. Thanks |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-02-01 09:08:40 AM
Re:Dual monitors. Minimize all window from one of them
"Star" < XXXX@XXXXX.COM >wrote in message
QuoteI have tried using Enumwindows, but I get a huge list of monitor. If you only want windows that appear in the TaskBar, then use GetWindowLong() to filter out the HWNDs that do not have the WS_EX_APPWINDOW style. To filter out HWNDs by specific monitor, use MonitorFromWindow() as well. Gambit |
Star
![]() CBuilder Developer |
2007-02-02 12:22:00 AM
Re:Dual monitors. Minimize all window from one of them
Hi Remy,
Thanks for your answer. Ok, I have tried this: BOOL CALLBACK ewp(HWND hwnd, LPARAM lParam) { long exstyle = GetWindowLong(hwnd, GWL_EXSTYLE); if(exstyle & WS_EX_APPWINDOW) { int length = GetWindowTextLength(hwnd); char *ch = new char[length]; GetWindowText(hwnd, ch, length); Form1->Memo1->Lines->Add(ch); delete[] ch; } return true; } void __fastcall TForm1::Button1Click(TObject *Sender) { EnumWindows((WNDENUMPROC)ewp, NULL); } For some reason it shows windows that were close sometime ago and it doesn't show the tasks that I have currently in the taskbar. Am I missing something? Thanks Remy Lebeau (TeamB) wrote: Quote"Star" < XXXX@XXXXX.COM >wrote in message {smallsort} |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-02-02 02:23:30 AM
Re:Dual monitors. Minimize all window from one of them
"Star" < XXXX@XXXXX.COM >wrote in message
QuoteFor some reason it shows windows that were close sometime ago Quoteit doesn't show the tasks that I have currently in the taskbar. WS_EX_APPWINDOW style are allowed to appear in the TaskBar, but that is not a guarantee that they actually will appear. One thing you can do is query the window's Owner window. If an WS_EX_APPWINDOW window has no owner, then it will appear in the TaskBar. One thing to keep in mind is that a window's TaskBar button may be managed by another window instead (and the VCL actually does this). So it may be that a given window does not have the WS_EX_APPWINDOW style, but it may have a hidden owner window that does. Gambit |