Peter Kiers
asked on
FontDialog1.Handle problem
Dear Experts,
I fount this procedure to hide the Size combobox
of the fontdialog-component:
procedure TMainForm.FontDialog1Show( Sender: TObject);
function EnumChildren(hwndChild: HWND; lParam: Integer): BOOL; stdcall;
begin
ShowWindow(hwndChild, SW_HIDE);
result:=True;
end;
begin
// 1090 is the Dialog ID for the size label
ShowWindow(GetDlgItem(Font Dialog1.Ha ndle, 1090), SW_HIDE);
// 1138 is the dialog for the size combo box
ShowWindow(GetDlgItem(Font Dialog1.Ha ndle, 1138), SW_HIDE);
// Handle the size combo child list as well
EnumChildWindows(GetDlgIte m(FontDial og1.Handle , 1138), @EnumChildren, 0);
end;
I want to hide the groupbox Effect too. How can I find
out the handle of it. I have create a litte programm with
code that i have from www.torry.net to get the handle
of a component, but I get diffirent handle-numbers!
How do I find out the handle-number of the groupbox Effects?
Greetings,
Peter Kiers
I fount this procedure to hide the Size combobox
of the fontdialog-component:
procedure TMainForm.FontDialog1Show(
function EnumChildren(hwndChild: HWND; lParam: Integer): BOOL; stdcall;
begin
ShowWindow(hwndChild, SW_HIDE);
result:=True;
end;
begin
// 1090 is the Dialog ID for the size label
ShowWindow(GetDlgItem(Font
// 1138 is the dialog for the size combo box
ShowWindow(GetDlgItem(Font
// Handle the size combo child list as well
EnumChildWindows(GetDlgIte
end;
I want to hide the groupbox Effect too. How can I find
out the handle of it. I have create a litte programm with
code that i have from www.torry.net to get the handle
of a component, but I get diffirent handle-numbers!
How do I find out the handle-number of the groupbox Effects?
Greetings,
Peter Kiers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>Effects group box id is 1072 I think.
Sorry, I hadn't noticed that mokule had already told you this...
You can also find out the control id's yourself if you want to experiment :)
Add a button, a memo and a font dialog to a form and assign Button1Click to the button:
When clicking the button, the font dialog will appear and the control ids will be displayed in the memo
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
FontDialog1: TFontDialog;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure FontDialog1Show(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender : TObject);
begin
FontDialog1.Execute;
end;
function EnumProc(wnd: HWND; Lines: TStrings): BOOL; stdcall;
var
buf, Caption: array [0..255] of char;
begin
Result := True;
GetClassname(wnd, buf, 256);
GetWindowText(wnd, Caption, 256);
Lines.Add(Format('ID: %d, class: %s, caption: %s',
[GetDlgCtrlID(wnd), buf, Caption]));
end;
procedure TForm1.FontDialog1Show(Sen der: TObject);
begin
Memo1.Clear;
EnumChildWindows(FontDialo g1.Handle, @EnumProc, Integer(Memo1.Lines));
end;
end.
Sorry, I hadn't noticed that mokule had already told you this...
You can also find out the control id's yourself if you want to experiment :)
Add a button, a memo and a font dialog to a form and assign Button1Click to the button:
When clicking the button, the font dialog will appear and the control ids will be displayed in the memo
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
FontDialog1: TFontDialog;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure FontDialog1Show(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender
begin
FontDialog1.Execute;
end;
function EnumProc(wnd: HWND; Lines: TStrings): BOOL; stdcall;
var
buf, Caption: array [0..255] of char;
begin
Result := True;
GetClassname(wnd, buf, 256);
GetWindowText(wnd, Caption, 256);
Lines.Add(Format('ID: %d, class: %s, caption: %s',
[GetDlgCtrlID(wnd), buf, Caption]));
end;
procedure TForm1.FontDialog1Show(Sen
begin
Memo1.Clear;
EnumChildWindows(FontDialo
end;
end.
Peter 430 is in hex which is equal 1072 decimal
ASKER
Thank for the info
Greetings,
Peter Kiers
Greetings,
Peter Kiers
Here's more about it (replacing text on dialogs):
http://www.swissdelphicenter.ch/torry/showcode.php?id=419
http://www.swissdelphicenter.ch/torry/showcode.php?id=419
ASKER
Windowse give Control id: 0430
But that doesn't work and 1072 does!
PK