Solved

FontDialog1.Handle problem

Posted on 2007-03-29
7
230 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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