然后在按一个快捷键又可以弹出来??

解决方案 »

  1.   

    给你个我做的控制桌面的程序
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, CommCtrl;type
      TForm1 = class(TForm)
        CheckBox1: TCheckBox;
        CheckBox2: TCheckBox;
        CheckBox3: TCheckBox;
        CheckBox4: TCheckBox;
        CheckBox5: TCheckBox;
        CheckBox6: TCheckBox;
        CheckBox7: TCheckBox;
        GroupBox1: TGroupBox;
        GroupBox2: TGroupBox;
        Button1: TButton;
        Button2: TButton;
        Button3: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure Button3Click(Sender: TObject);
      private
        { Private declarations }
        procedure CheckButtonClick(Sender: TObject);
      public
        { Public declarations }
      end;
    const
      //定义不同窗口的类名
      sTrayWindow = 'Shell_TrayWnd';
      sTrayNotify = 'TrayNotifyWnd';
      sStartButton = 'Button';
      sAppSwitchBar = 'ReBarWindow32';
      sAppSwitch = 'MSTaskSwWClass';
      sAppIcon = 'ToolbarWindow32';
      sTrayClock = 'TrayClockWClass';
      sDesktopIcon = 'ShellDll_DefView';
      sProgman = 'Progman';
    var
      Form1: TForm1;
      wnd: integer;implementation{$R *.DFM}//-------------------------------------桌面控制-------------------------------//procedure TForm1.CheckButtonClick(Sender: TObject);
    var
      i: Integer;
    begin
      wnd := FindWindow(sTrayWindow, nil);
      if (TCheckBox(Sender).Name) = 'CheckBox2' then
        wnd := FindWindowEx(wnd, 0, sStartButton, nil);
      if (TCheckBox(Sender).Name) = 'CheckBox3' then
        wnd := FindWindowEx(wnd, 0, sTrayNotify, nil);
      if (TCheckBox(Sender).Name) = 'CheckBox4' then
      begin
        wnd := FindWindowEx(wnd, 0, sAppSwitchBar, nil);
        wnd := FindWindowEx(wnd, 0, sAppSwitch, nil);
      end;
      if (TCheckBox(Sender).Name) = 'CheckBox5' then
      begin
        wnd := FindWindowEx(wnd, 0, sTrayNotify, nil);
        wnd := FindWindowEx(wnd, 0, sTrayClock, nil);
      end;
      if (TCheckBox(Sender).Name) = 'CheckBox6' then
      begin
        wnd := FindWindow(sProgman, nil);
        wnd := FindWindowEx(wnd, 0, sDesktopIcon, nil);
      end;
      if (TCheckBox(Sender).Name) = 'CheckBox7' then
      begin
        wnd := FindWindowEx(wnd, 0, sAppSwitchBar, nil);
        wnd := FindWindowEx(wnd, 0, sAppIcon, nil);
      end;
      if TCheckBox(Sender).Checked then
        ShowWindow(wnd, SW_HIDE)
      else
        ShowWindow(wnd, SW_SHOW);
    end;
    //----------------------------------end---------------------------------------////---------------------------------桌面图标控制-------------------------------//procedure SetDesktopIconColor(Forground, Background: TColor; Trans: Boolean);
    var
      Window: HWND;
    begin
      Window := FindWindow('Progman', 'Program Manager');
      //找到桌面窗口
      Window := FindWindowEx(Window, HWND(nil), 'SHELLDLL_DefView', '');
      //找到放置桌面图标的ListView窗口
      Window := FindWindowEx(Window, HWND(nil), 'SysListView32', '');
      if Trans then //设置透明的文字背景色
        ListView_SetTextBkColor(Window, $FFFFFFFF) // back color
      else //设置不透明的文字背景色
        ListView_SetTextBkColor(Window, Background); // back color
      ListView_SetTextColor(Window, Forground); // foreground color
      //重新绘制桌面图标
      ListView_RedrawItems(Window, 0, ListView_GetItemCount(Window) - 1);
      UpdateWindow(Window); //重新绘制窗口
    end;procedure SetDeskTopIconArr(iWidth, iHeight: Integer);
    var
      Window: HWND;
      i, i1, i2, iCount: integer;
    begin
      Window := FindWindow('Progman', 'Program Manager');
      Window := FindWindowEx(Window, HWND(nil), 'SHELLDLL_DefView', '');
      Window := FindWindowEx(Window, HWND(nil), 'SysListView32', '');
      //设置图标与边界的距离。
      i1 := 20;
      i2 := 20;
      //获得桌面图标的个数
      iCount := ListView_GetItemCount(Window) - 1;
      for i := 0 to iCount do
      begin
        //设置图标位置
        ListView_SetItemPosition(Window, i, i1, i2);
        i1 := i1 + iWidth;
        if i1 > (Screen.Width - 32) then
        begin
          i1 := 20;
          i2 := i2 + iHeight;
        end;
      end;
      ListView_RedrawItems(Window, 0, ListView_GetItemCount(Window) - 1);
      UpdateWindow(Window);
    end;procedure SetDefaultIconColors;
    var
      Kind: Integer;
      Color: TColor;
    begin
      Kind := COLOR_DESKTOP;
      Color := GetSysColor(COLOR_DESKTOP);
      SetSysColors(1, Kind, Color);
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      //你可以改变clWhite,clBlack为其它的颜色值看看
      //图标文本颜色的变化
      SetDesktopIconColor(clRed, clYellow, True);
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      //设置图标的间距为100个像素
      SetDeskTopIconArr(100, 100);
    end;
    //---------------------------------------end----------------------------------//procedure TForm1.FormCreate(Sender: TObject);
    begin
      CheckBox1.OnClick := CheckButtonClick;
      CheckBox2.OnClick := CheckButtonClick;
      CheckBox3.OnClick := CheckButtonClick;
      CheckBox4.OnClick := CheckButtonClick;
      CheckBox5.OnClick := CheckButtonClick;
      CheckBox6.OnClick := CheckButtonClick;
      CheckBox7.OnClick := CheckButtonClick;
    end;procedure TForm1.Button3Click(Sender: TObject);
    begin
      SetDesktopIconColor(clWhite, clBlack, True);
    end;end.
      

  2.   

    www.bemanner.com看我的软件,有源码
    其实用了控件,不好意思啊
      

  3.   

    你把图标移走就可以了
    function shell_notifyicon(dwmessage:dword;lpdata:pnotifyicondata):bool;stdcall;参数说明:
      dwmessage:描述了对图标的操作
           NIM_ADD       加到托盘上
           NIM_MODIFY    改其属性 
           NIM-DELETE    移走