Solved

FontDialog1.Handle problem

Posted on 2007-03-29
7
231 Views
Last Modified: 2010-04-05
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(FontDialog1.Handle, 1090), SW_HIDE);
  // 1138 is the dialog for the size combo box
  ShowWindow(GetDlgItem(FontDialog1.Handle, 1138), SW_HIDE);
  // Handle the size combo child list as well
  EnumChildWindows(GetDlgItem(FontDialog1.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
0
Comment
Question by:peterkiers
  • 3
  • 2
  • 2
7 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 250 total points
ID: 18821968
Download Windowse utility from
http://delphi.about.com/gi/dynamic/offsite.htm?site=http://www.greatis.com/windowse.htm
And You can get all control's id.

Effects group box id is 1072 I think.
0
 
LVL 28

Assisted Solution

by:TName
TName earned 250 total points
ID: 18822032
Hi, add these lines to FontDialog1Show():

//Effects
 ShowWindow(GetDlgItem(FontDialog1.Handle, 1072), SW_HIDE);
 //Strike through
 ShowWindow(GetDlgItem(FontDialog1.Handle, 1040), SW_HIDE);
 //Underline
 ShowWindow(GetDlgItem(FontDialog1.Handle, 1041), SW_HIDE);
 //
 ShowWindow(GetDlgItem(FontDialog1.Handle, 1091), SW_HIDE);
 // Color label
 ShowWindow(GetDlgItem(FontDialog1.Handle, 1031), SW_HIDE);
 // Color combo
 ShowWindow(GetDlgItem(FontDialog1.Handle, 1139), SW_HIDE);
 EnumChildWindows(GetDlgItem(FontDialog1.Handle, 1139), @EnumChildren, 0);
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18822038
When I point the groupbox Effects
Windowse give Control id: 0430
But that doesn't work and 1072 does!

PK
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Expert Comment

by:TName
ID: 18822054
>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(Sender: TObject);

begin
 Memo1.Clear;
 EnumChildWindows(FontDialog1.Handle, @EnumProc, Integer(Memo1.Lines));
end;

end.
0
 
LVL 17

Expert Comment

by:mokule
ID: 18822072
Peter 430 is in hex which is equal 1072 decimal
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18822075
Thank for the info

Greetings,

Peter Kiers
0
 
LVL 28

Expert Comment

by:TName
ID: 18822078
Here's more about it (replacing text on dialogs):
http://www.swissdelphicenter.ch/torry/showcode.php?id=419
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 185
enhance the following code 3 42
how can i delete one control based on its tagstring ? 6 34
TlistView is Really heavy on Android 3 12
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question