求一个类似迅雷图标的小程序,可以总在桌面的最前面,在线等!

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        lblTest: TLabel;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        
      protected
          procedure CreateParams(var Params: TCreateParams);override;  public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.CreateParams(var Params: TCreateParams);
    begin
      inherited CreateParams(Params);  with Params do
      begin
          Style := WS_POPUP or WS_CLIPSIBLINGS {or WS_BORDER}; 
          ExStyle := WS_EX_TOOLWINDOW or WS_EX_TOPMOST;
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_LAYERED);
      SetLayeredWindowAttributes(Handle, clWhite, 200, LWA_ALPHA or LWA_COLORKEY);
    end;end.
     
      

  2.   

    给你做了一个:窗体代码:object Form1: TForm1
      Left = 820
      Top = 113
      AlphaBlend = True
      AlphaBlendValue = 200
      AutoSize = True
      BorderStyle = bsNone
      Caption = 'Form1'
      ClientHeight = 36
      ClientWidth = 115
      Color = 25
      TransparentColor = True
      TransparentColorValue = 25
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      OldCreateOrder = False
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object Image1: TImage
        Left = 0
        Top = 0
        Width = 36
        Height = 36
        AutoSize = True
        PopupMenu = PopupMenu1
        OnMouseDown = Image1MouseDown
      end
      object PopupMenu1: TPopupMenu
        AutoHotkeys = maManual
        Left = 80
        Top = 8
        object N1: TMenuItem
          Caption = #26356#25442#22270#29255
          OnClick = N1Click
        end
        object N2: TMenuItem
          Caption = #36864#20986#31243#24207
          OnClick = N2Click
        end
      end
      object OpenPictureDialog1: TOpenPictureDialog
        Filter = 'JPG'#22270#29255'|*.jpg|BMP'#22270#29255'|*.bmp'
        Left = 40
        Top = 8
      end
    end
    程序代码:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, Menus, ExtDlgs,jpeg;type
      TForm1 = class(TForm)
        Image1: TImage;
        PopupMenu1: TPopupMenu;
        N1: TMenuItem;
        N2: TMenuItem;
        OpenPictureDialog1: TOpenPictureDialog;
        procedure FormCreate(Sender: TObject);
        procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
        procedure N1Click(Sender: TObject);
        procedure N2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
    SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
    end;procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
    ReleaseCapture;
    SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); 
    end;procedure TForm1.N1Click(Sender: TObject);
    begin
     if OpenPictureDialog1.Execute then
      image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
    end;procedure TForm1.N2Click(Sender: TObject);
    begin
    close
    end;end.或者,你直接点www.mwymwy.cn/xun.rar下载。
      

  3.   

    unit   Unit1;   
        
      interface   
        
      uses   
          Windows,   Messages,   SysUtils,   Classes,   Graphics,   Controls,   Forms,   Dialogs,   
          StdCtrls,   shellapi;   
        
      type   
          TForm1   =   class(TForm)   
              Button1:   TButton;   
              procedure   Button1Click(Sender:   TObject);   
          private   
              {   Private   declarations   }   
          public   
              procedure   IconOnClick(var   message:   TMessage);   message   WM_USER+1;   
              {   Public   declarations   }   
          end;   
        
      var   
          Form1:   TForm1;   
        
      implementation   
        
      {$R   *.DFM}   
        
      procedure   TForm1.Button1Click(Sender:   TObject);   
      var   
          Icondata:   TNotifyIconDataA;   
      begin   
          IconData.cbSize   :=   SizeOf(IconData);   
          IconData.Wnd   :=   Self.Handle;   
          IconData.uID   :=   1;   
          IconData.uFlags   :=   1     or   2   or   4;   
          IconData.uCallBackMessage   :=   WM_USER+1;   
          IconData.hIcon   :=   Application.Icon.Handle;   
          IconData.szTip   :=   'TrayTest';   
          Shell_NotifyIcon(NIM_ADD,   @IconData   );   
          SetWindowLong(Application.Handle,   
              GWL_EXSTYLE,WS_EX_TOOLWINDOW);   
          ShowWindow(Self.Handle,   SW_HIDE);   
      end;   
        
        
      procedure   TForm1.IconOnClick(   var   message:   Tmessage);   
      begin   
          if   (message.lParam   =   WM_LBUTTONDOWN)   then   
              ShowWindow(Handle,   SW_SHOW   );   
      end;   
        
      end.