Buscar

Colocando seu programa no painel de controle

Código

{Abaixo segue o código para seu programa no Painel de Controle.
  Para começar adicione a Unit Cpl ao seu projeto.}


  Library Project1; {Muda de "programa" para "library"}
  uses
    Cpl, {use Cpl unit}
    Windows,
    Forms,
    Unit1 in 'Unit1.pas' {Form1};

  {$R *.RES}

  procedure ExecuteApp;
  begin
    Application.Initialize;
    Application.CreateForm(TForm1,Form1);
    Application.Run;
  end;

  {A callback function to export at Control Panel}
  function CPlApplet(hwndCPl: THandle; uMsg: DWORD;  lParam1, lParam2: LongInt):LongInt;stdcall;
  var
    NewCplInfo:PNewCplInfo;
 begin
   Result:=0;
    case uMsg of
    {Initialization.Return True.}
    CPL_INIT : Result:=1;
    {Number of Applet.}
    CPL_GETCOUNT : Result:=1;
    {Transporting informations of this Applet to the Control Panel.}
    CPL_NEWINQUIRE :
    begin
      NewCplInfo:=PNewCplInfo(lParam2);
      with NewCplInfo^ do
      begin
        dwSize:=SizeOf(TNewCplInfo);
        dwFlags:=0;
        dwHelpContext:=0;
        lData:=0;
        {An icon to display on Control Panel.}
        hIcon:=LoadIcon(HInstance,'MAINICON');
        {Applet name}
        szName:='Project1';
        {Description of this Applet.}
        szInfo:='This is a test Applet.';
        szHelpFile:='';
      end;
    end;
    {Executing this Applet.}
    CPL_DBLCLK : ExecuteApp;
    else Result:=0;
    end;
  end;

  {Exporting the function of CplApplet}
  exports
  CPlApplet;
  begin

  end.
 

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Windows
Adicionada dia: 30/07/03
Por: Felipe Monteiro
Visualizada: 2361 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009