请教:Dephi 中将程序最小化为任务栏中的图标,但我不知道如何加入图标右(或左)键菜单,请高手指点!

解决方案 »

  1.   

    用系统托盘组件。在abc, rxlib 组件里有。trayico控件。www.51delphi.com有下载
      

  2.   

    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls,  Dialogs,
      StdCtrls, ExtCtrls,Forms, Menus,shellapi;
    const MY_MESSAGE=wm_user+100;//接收用户信息
    添加一个处理信息过程
    procedure msgwnd(var message:tmessage); message MY_MESSAGE;
    我的这个是处理单击右键和双击左键的。
    procedure Ttimefrm.msgwnd(var message:tmessage);
    var i,j:integer;
    begin
    i:=Mouse.CursorPos.X;
    j:=Mouse.Cursorpos.y;
    case message.lParam of
     WM_LBUTTONDBLCLK: begin 双击的处理 end;
     WM_RBUTTONDOWN: begin  popupmenu1.Popup(i,j);//右键的处理弹出菜单 end;
     end;
    end;
    定义  ss:NotifyIconData;
    ss.cbSize := sizeof(NotifyIconData);
    ss.Wnd := handle;
    ss.uID := 1;
    ss.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
    ss.uCallbackMessage := MY_MESSAGE;//连接上处理信息
    ss.hIcon :=loadicon(hinstance,'MAINICON');
    ss.szTip:='桌面时钟';
    width:=200;
    height:=200;
    xcen:=100;
    ycen:=100;
    radiusl:=75;
    shell_notifyIconA(nim_add,@ss);
      

  3.   

    这句为什么不能执行过去!uses中已经引用了shellapi了呀!
    Procedure MyNotify(var Msg:TMessage);message WM_MYNOTIFY;
      

  4.   

    你定义信息了么?
    const MY_MESSAGE=wm_user+100;//接收用户信息
      

  5.   

    你检查一下定义ss:NotifyIconData;

    ss.uCallbackMessage := wm_mynotify;//连接上处理信息
    么?