Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages
Started by Star
Wed, 31 Jan 2007 22:56
Dual monitors. Minimize all window from one of them
Author: Star
Date: Wed, 31 Jan 2007 22:56
Date: Wed, 31 Jan 2007 22:56
14 lines
1392 bytes
1392 bytes
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
Re: Dual monitors. Minimize all window from one of them
Author: Remy Lebeau (TeamB)
Date: Thu, 01 Feb 2007 01:08
Date: Thu, 01 Feb 2007 01:08
16 lines
1570 bytes
1570 bytes
"Star" <noemai@noemail.com> wrote in message news:45c11e55$1@newsgroups.borland.com... > I have tried using Enumwindows, but I get a huge list of > windows and not the ones that are in the taskbar. You are not taking into account that EnumWindows() returns all available top-level windows, including hidden windows, regardless 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
Re: Dual monitors. Minimize all window from one of them
Author: Star
Date: Thu, 01 Feb 2007 16:22
Date: Thu, 01 Feb 2007 16:22
53 lines
2282 bytes
2282 bytes
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:
> "Star" <noemai@noemail.com> wrote in message
> news:45c11e55$1@newsgroups.borland.com...
>
>> I have tried using Enumwindows, but I get a huge list of
>> windows and not the ones that are in the taskbar.
>
> You are not taking into account that EnumWindows() returns all
> available top-level windows, including hidden windows, regardless 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
>
>
Re: Dual monitors. Minimize all window from one of them
Author: Remy Lebeau (TeamB)
Date: Thu, 01 Feb 2007 18:23
Date: Thu, 01 Feb 2007 18:23
24 lines
1931 bytes
1931 bytes
"Star" <noemai@noemail.com> wrote in message news:45c21372$1@newsgroups.borland.com... > For some reason it shows windows that were close sometime ago Then they are not fully closed. > it doesn't show the tasks that I have currently in the taskbar. I never said that WS_EX_APPWINDOW by itself would tell you all of the items that are actually in the TaskBar. Only windows with the 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads