Solved

FontDialog1.Handle problem

Posted on 2007-03-29
7
221 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
Comment Utility
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
Comment Utility
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
Comment Utility
When I point the groupbox Effects
Windowse give Control id: 0430
But that doesn't work and 1072 does!

PK
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 28

Expert Comment

by:TName
Comment Utility
>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
Comment Utility
Peter 430 is in hex which is equal 1072 decimal
0
 
LVL 1

Author Comment

by:peterkiers
Comment Utility
Thank for the info

Greetings,

Peter Kiers
0
 
LVL 28

Expert Comment

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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now