Solved

FontDialog1.Handle problem

Posted on 2007-03-29
7
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

617 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