Board index » delphi » Hint's Font Name

Hint's Font Name

Is there a way of changing the Font Name of an application's hints
under D3 (something like TApplication.HintColor) ?

Thanks in advance

Mytskidis Georgios

 

Re:Hint's Font Name


On Fri, 12 Nov 1999 14:09:19 +0200, "Mytskidis Georgios"

Quote
<medi...@ath.forthnet.gr> wrote:
>Is there a way of changing the Font Name of an application's hints
>under D3 (something like TApplication.HintColor) ?

Normally NO! Because FHintWindow is a private method of TApplication.
But... nothing is unreal!
Example see below (it is my own trick):

procedure SetCustomHintFont;
var p : pointer;
begin
  p := Application;
  p := Ptr(Longint(p)+$6C);
  with THintWindow(p^).Canvas do
  begin
    Font.Name := 'Courier';
    Font.CharSet := RUSSIAN_CHARSET;
    Font.Size := 8;
  end;
end;

   This works nice in Delphi4. If TApplication has a different fields
set in D3, You have to change the value "$6C" above, because that is
FHintWindow offset.
   By the way such technique can be applied to access to any private
method/field of any class!

Sincerely,
Alexander.

Alexander B. Bokovikov
E-mail: a...@adx.ru
WWW: http://a-press.parad.ru/pc/bokovikov/delphi

Re:Hint's Font Name


Alexander B. Bokovikov skrev i meldingen
<3832390c.45877...@athene.hdm-stuttgart.de>...

Quote
>procedure SetCustomHintFont;
>var p : pointer;
>begin
>  p := Application;
>  p := Ptr(Longint(p)+$6C);
>  with THintWindow(p^).Canvas do

Be glad this is not an official Borland NG...people get arrested for
less than that ! ;-)

--

Bjoerge

Re:Hint's Font Name


In article <3832390c.45877...@athene.hdm-stuttgart.de>, a...@adx.ru (Alexander

Quote
B. Bokovikov) writes:
>Normally NO! Because FHintWindow is a private method of TApplication.
>But... nothing is unreal!
>Example see below (it is my own trick):

>procedure SetCustomHintFont;
>var p : pointer;
>begin
>  p := Application;
>  p := Ptr(Longint(p)+$6C);
>  with THintWindow(p^).Canvas do
>  begin
>    Font.Name := 'Courier';
>    Font.CharSet := RUSSIAN_CHARSET;
>    Font.Size := 8;
>  end;
>end;

>   This works nice in Delphi4. If TApplication has a different fields
>set in D3, You have to change the value "$6C" above, because that is
>FHintWindow offset.

That's a real hack <gg> but you can make it a little less obscure by coding :-

type
  TDummyApplication = class(TComponent)
  private
    FHandle: HWnd;
    FObjectInstance: Pointer;
    FMainForm: TForm;
    FMouseControl: TControl;
    FHelpFile: string;
    FHint: string;
    FHintActive: Boolean;
    FUpdateFormatSettings: Boolean;
    FUpdateMetricSettings: Boolean;
    FShowMainForm: Boolean;
    FHintColor: TColor;
    FHintControl: TControl;
    FHintCursorRect: TRect;
    FHintPause: Integer;
    FHintShortPause: Integer;
    FHintHidePause: Integer;
    FHintWindow: THintWindow;  // copy down to this line
  end;

These are copied from the beginning of the TApplication declaration in
Forms.pas with the class changed to TDummyApplication.

Then

  with TDummyApplication(Application).FHintWindow.Canvas do
  begin
    Font.Name := 'Courier';
    Font.CharSet := RUSSIAN_CHARSET;
    Font.Size := 8;
  end;

But of course if Borland re-arranges those private fields then your code goes
"bottoms up".

Alan Lloyd
alangll...@aol.com

Other Threads