1、我想实现像FoxMail那样的效果,最小化的时候只有在任务栏只有个小图标,单击它恢复窗口。鼠标放上去的时候有个Hint。
2、如果通过一个程序控制另外一个程序,这两个程序是完全独立的。比如说我需要在这个程序满足一定条件的时候关闭另外一个程序。

解决方案 »

  1.   

    1:很简单的,也是提问率很高的问题
    2:找到那个程序句柄,发消息就是了,如
    postmessage(handle,wm_close,0,0);
      

  2.   

    第二个问题:
      你可以用 delphi中带的WinSight32工具来看程序的句丙
      

  3.   

    两个幼稚的问题,不知怎么答好.推荐一套控件:Raize.
    里面有解决办法
      

  4.   

    1.第一个问题
      Tmainform = class(TForm)
        PopupMenu1: TPopupMenu;
        N7: TMenuItem;
      private
        { Private declarations }
        procedure mymessage(var message:tmessage);message mymsg;
      public
        { Public declarations }
      end;
    var
      mainform: Tmainform;ntid:tnotifyicondataa;
      procedure TForm1.mymessage(var message:tmessage);
    var mypt:tpoint;
    begin
    inherited;
    if message.lparam=wm_rbuttonup then
    begin
      getcursorpos(mypt);
      popupmenu1.popup(mypt.x,mypt.y);//弹出菜单
    end
    else
    begin
      if message.LParam=WM_LBUTTONDBLCLK then
      begin
        //执行你的命令
      end;
    end;
    message.Result:=0;
    end;procedure Tmainform.FormCreate(Sender: TObject);
    var
      zappname:array[0..127] of char;
      hold:string;
      found:hwnd;
    begin
      ntid.cbSize:=sizeof(tnotifyicondataa);
      ntid.Wnd:=handle;
      ntid.uID:=iid;
      ntid.uFlags:=nif_icon+nif_tip+nif_message;
      ntid.uCallbackMessage:=mymsg;
      ntid.hIcon:=application.Icon.handle;
      ntid.szTip:='{你要显示的文本}';
      shell_notifyicona(NIM_ADD,@ntid);
    end;
      

  5.   

    1.第一个问题
      Tmainform = class(TForm)
        PopupMenu1: TPopupMenu;
        N7: TMenuItem;
      private
        { Private declarations }
        procedure mymessage(var message:tmessage);message mymsg;
      public
        { Public declarations }
      end;
    var
      mainform: Tmainform;ntid:tnotifyicondataa;
      procedure TForm1.mymessage(var message:tmessage);
    var mypt:tpoint;
    begin
    inherited;
    if message.lparam=wm_rbuttonup then
    begin
      getcursorpos(mypt);
      popupmenu1.popup(mypt.x,mypt.y);//弹出菜单
    end
    else
    begin
      if message.LParam=WM_LBUTTONDBLCLK then
      begin
        //执行你的命令
      end;
    end;
    message.Result:=0;
    end;procedure Tmainform.FormCreate(Sender: TObject);
    var
      zappname:array[0..127] of char;
      hold:string;
      found:hwnd;
    begin
      ntid.cbSize:=sizeof(tnotifyicondataa);
      ntid.Wnd:=handle;
      ntid.uID:=iid;
      ntid.uFlags:=nif_icon+nif_tip+nif_message;
      ntid.uCallbackMessage:=mymsg;
      ntid.hIcon:=application.Icon.handle;
      ntid.szTip:='{你要显示的文本}';
      shell_notifyicona(NIM_ADD,@ntid);
    end;
      

  6.   

    用findwindow找窗体句柄,用进程关闭,postmessage(handle,wm_close,0,0);只是发送关闭消息,用进程关闭时强行关闭,一定能关得了:
    var  H:THandle;//窗口句柄
      P:DWORD;
      str: string;//窗口名称
    begin
      Str := 'Project1';//改成你要的名字
      H:=FindWindow(nil,pchar(Str));
      if H<>0 then
      begin
        GetWindowThreadProcessId(H,@P);
        if P<>0 then
          TerminateProcess(OpenProcess(PROCESS_TERMINATE,False,P),$FFFFFFFF);
      end;
    end;
    ...str是窗体名字