Discussion:
CreateParams
(too old to reply)
sa
2008-06-16 06:03:00 UTC
Permalink
Hi all.

I want to display a form always top.

I created a Project1 with Form1 (BCB6)

//header file
void __fastcall TForm1::CreateParams(TCreateParams &Params)

//cpp file
void __fastcall TForm1::CreateParams(TCreateParams &Params)
{
TForm::CreateParams(Params);
Params.ExStyle = Params.ExStyle | WS_EX_PALETTEWINDOW;
Params.WndParent = GetDesktopWindow();
}
//---------------------------------------------------------------------------

1.Problem is 2 instances in the Task Manager (Project1 and Form1). Is there
anyway to remove Form1 instance in the TaskManager-Applications.

Kind Regards
SA
Remy Lebeau (TeamB)
2008-06-16 16:58:09 UTC
Permalink
Post by sa
I want to display a form always top.
Have you tried setting the form's FormStyle to fsStayOnTop yet?

Have you tried using SetWindowLong() to set the WS_EX_TOPMOST flag yet?
Post by sa
Params.ExStyle = Params.ExStyle | WS_EX_PALETTEWINDOW;
Problem is 2 instances in the Task Manager (Project1 and Form1). Is there
anyway to remove Form1 instance in the TaskManager-Applications.
No, because your code is forcing "Form1" to appear when it normally wouldn't
by default. However, you can remove "Project1" by doing the following:

ShowWindow(Application->Handle, SW_HIDE)


Gambit
sa
2008-06-18 20:42:59 UTC
Permalink
Hi Remy thanks for reply

Using fsStayOnTop and WS_EX_TOPMOST, form can be minimized with we press
windows+d shortcut which i don't want.

Is there any way to set this behaviour as taskbar form like

1.The taskbar button is not displayed for explorer.exe
2.in the windows task manager->Application there is instance.

What properties or flags does the taskbar form uses. I noticed taskbar will
not minimize when i press windows+d. I want to set same for the form. I know
this is APPBAR, my form is also APPBAR.

Thanks for suggestions
SA
Remy Lebeau (TeamB)
2008-06-19 17:12:49 UTC
Permalink
Post by sa
Using fsStayOnTop and WS_EX_TOPMOST, form can
be minimized with we press windows+d shortcut which i don't want.
Intercept the WM_SYSCOMMAND message, look for the SC_MINIMIZE flag, and if
detected than discard the message without passing it on to the default
message handler.

Or, use GetSystemMenu() and DeleteMenu() to remove the SC_MINIMIZE menu item
from the window.


Gambit
sa
2008-06-28 03:43:27 UTC
Permalink
I used the following code to discard the message, but windows+d can still
minimize the form

void __fastcall TForm1::WndProc(TMessage &Message)
{
switch (Message.Msg)
{
case WM_SYSCOMMAND:
switch(Message.WParam)
{
case SC_MINIMIZE:
Message.WParam = 1000;
}
}
TForm::WndProc(Message);
}

Thanks
SA
Remy Lebeau (TeamB)
2008-06-30 16:58:33 UTC
Permalink
Post by sa
I used the following code to discard the message, but windows+d
can still minimize the form
You are not processing the message correctly. Try this instead:

void __fastcall TForm1::WndProc(TMessage &Message)
{
if ((Message.Msg == WM_SYSCOMMAND) &&
((Message.WParam & 0xFFF0) == SC_MINIMIZE) )
return;

TForm::WndProc(Message);
}


Gambit
sa
2008-07-08 01:54:40 UTC
Permalink
Thanks Remy, have you tested the code.
I copied same code and tested, it is not working Form can be minimized
using windows+d combination key stroke.

Thanks
SA

Loading...