Einzelnen Beitrag anzeigen

Benutzerbild von Sprint
Sprint

Registriert seit: 18. Aug 2004
Ort: Edewecht
712 Beiträge
 
Delphi 5 Professional
 
#4

Re: Taskleistensymbol-Menü verändern

  Alt 7. Nov 2004, 14:33
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

const
  WM_USER_INFOMENU = WM_USER + $101;
  S_INFOMENU = '&Info';

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure OnAppMsg(var Msg: TMsg; var Handled: Boolean);
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.OnAppMsg(var Msg: TMsg; var Handled: Boolean);
begin

  if (Msg.message = WM_SYSCOMMAND) and (Msg.wParam = WM_USER_INFOMENU) then
  begin
    Application.MessageBox('Hello World!', nil, MB_OK or MB_ICONINFORMATION);
    Handled := True;
  end else
    Handled := False;

end;

procedure TForm1.FormCreate(Sender: TObject);
var
  SysMenu: HMENU;
begin

  Application.OnMessage := OnAppMsg;

  {Application's System Menu}
  SysMenu := GetSystemMenu(Application.Handle, False);
  AppendMenu(Sysmenu, MF_SEPARATOR, 0, nil);
  AppendMenu(SysMenu, MF_STRING, WM_USER_INFOMENU, S_INFOMENU);

  {Form System Menu}
  SysMenu := GetSystemMenu(Self.Handle, False);
  AppendMenu(Sysmenu, MF_SEPARATOR, 0, nil);
  AppendMenu(SysMenu, MF_STRING, WM_USER_INFOMENU, S_INFOMENU);

end;

end.
Ciao, Sprint.

"I don't know what I am doing, but I am sure I am having fun!"
  Mit Zitat antworten Zitat