修改它的res文件,加入你的图标.

解决方案 »

  1.   

    首先用记事本建立如下文件
    myIco ICON c;\my.ICO
    将其保存为与你程序同目录下的myico.rc文件
    此后,用brcc32.exe myico.rc命令,编译出myico.res文件
    在你的程序代码中 {$R  *.res} 下面,输入{$R  myico.res}语句;
    application.icon.handle := loadicon(hinstance,'myicon');
    就可以了。
    我没有在IDE环境中整理,凭记忆写出来的,大概就是这样.
      

  2.   

    program Pontifex;uses
      Forms,
      Windows,
      ShellAPI,
      Messages,
      Sysutils, 
      exSystem,
      Pontifex_TLB in 'Pontifex_TLB.pas',
      Server_CORBA in '..\2.program\0.服务器\Server_CORBA.pas' {CORBAServer_WeiHai: TCorbaDataModule} {CORBAServer_WeiHai: CoClass},
      Server_System in '..\2.program\0.服务器\Server_System.pas',
      Server in '..\2.program\0.服务器\Server.pas' {Form_Server};{$R *.TLB} {CORBA}{$R *.res}{$R Server.res}var AboutStr: string;
    var NID: TNotifyIconData;
        WndClass: array[0..50] of char;procedure Panic(szMessage: PChar);
    begin
      if szMessage<>nil then MessageBox(0, szMessage, PChar(VG_AppName), MB_OK);
      Halt(0);
    end;procedure HandleCommand(Wnd: hWnd; Cmd: Word);
    begin
      case Cmd of
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        //主窗口********************************************************************
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Ord('C'): if not Form_Server.Visible then Form_Server.ShowModal;
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        //关于**********************************************************************
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Ord('A'): MessageBox(0, PChar(AboutStr), PChar('关于...'), MB_OK);
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        //退出系统******************************************************************
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Ord('E'): begin
                    ServerOver; 
                    if Form_Server.Visible then Form_Server.Close;
                    PostMessage(Wnd, WM_CLOSE, 0, 0);
                  end;
      end;
    end;function DummyWindowProc(Wnd: hWnd; Msg, wParam: Word; lParam: LongInt): LongInt; stdcall;
    var TrayHandle: THandle;
        DC: hDC;
        pm: HMenu;
        pt: TPoint;
    begin
      DummyWindowProc := 0;
      StrPCopy(@WndClass[0], 'Quark');
      TrayHandle := FindWindow(@WndClass[0], nil);
      case Msg of
        WM_CREATE:  begin//Program initialisation - just set up a tray icon
                      NID.cbSize           := SizeOf(NID);
                      NID.Wnd              := Wnd;
                      NID.uID              := 1;
                      NID.uFlags           := nif_Message or nif_Icon or nif_Tip;
                      NID.uCallBackMessage := WM_User;
                      NID.hIcon            := LoadIcon(hInstance, 'TRAYICON');
                      Lstrcpy(NID.szTip,'Pontifex for Windows');
                      Shell_NotifyIcon(nim_Add, @NID);
                    end;
        WM_DESTROY: begin
                      Shell_NotifyIcon(nim_Delete, @NID);
                      PostQuitMessage(0);
                      ShowWindow(TrayHandle, SW_RESTORE);
                    end;
        WM_COMMAND: begin//Command notification
                      HandleCommand(Wnd, LoWord(wParam));
                      Exit;
                    end;
        WM_USER:    case lParam of
                      //双击鼠标左键************************************************
                      WM_LBUTTONDBLCLK: if not Form_Server.Visible then Form_Server.ShowModal;
                      //单击鼠标右键************************************************
                      WM_RBUTTONDOWN:   begin
                                          GetCursorPos(pt);
                                          pm := CreatePopupMenu;
                                          AppendMenu(pm, 0,            Ord('C'), '客户端状态');
                                          AppendMenu(pm, MF_SEPARATOR, 0,        nil);
                                          AppendMenu(pm, 0,            Ord('A'), '关于Pontifex...');
                                          AppendMenu(pm, 0,            Ord('E'), '退出');
                                          SetForegroundWindow(Wnd);
                                          DC := GetDC(0);
                                          if TrackPopupMenu(pm, tpm_BottomAlign or tpm_RightAlign, pt.x,GetDeviceCaps(DC,HORZRES){pt.y}, 0, Wnd, nil)
                                          then SetForegroundWindow(Wnd);
                                          DestroyMenu(pm);
                                        end;
                    end;//case lParam of
      end;
      DummyWindowProc := DefWindowProc(Wnd, Msg, wParam, lParam);
    end;procedure WinMain;
    var Wnd: hWnd;
        Msg: TMsg;
        WndClass: TWndClass;
    begin
      { Previous instance running ?  If so, exit }
      if FindWindow(PChar(VG_AppName), nil)<>0 then Panic(PChar(VG_AppName + ' 已经运行。'));  { Register the window class }
      FillChar(WndClass, SizeOf(WndClass), 0);
      WndClass.lpfnWndProc := @DummyWindowProc;
      WndClass.hInstance := hInstance;
      WndClass.lpszClassName := PChar(VG_AppName);
      RegisterClass(WndClass);  { Now create the dummy window }
      Wnd := CreateWindow(PChar(VG_AppName), PChar(VG_AppName), WS_OVERLAPPEDWINDOW , 0, 0, 0, 0, 0, 0, hInstance, nil);
      if Wnd<>0 then
      begin
        ShowWindow(Wnd, SW_HIDE);
        while GetMessage(Msg, 0, 0, 0) do
        begin
          TranslateMessage(Msg);
          DispatchMessage(Msg);
        end;
      end;
    end;begin
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //系统变量初始化**************************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ServerInit;
      AboutStr :=            '北京博达新创科技发展有限公司(R)' + #13;
      AboutStr := AboutStr + '供热企业收费管理信息系统(C)'     + #13;
      AboutStr := AboutStr + 'Version of Server ' + GetApplicationVersion(Application.ExeName);  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      //创建主窗体,开始运行********************************************************
      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Application.Initialize;
      Application.CreateForm(TForm_Server, Form_Server);
      WinMain;
    end.
      

  3.   

    ); 
        case  Msg  of 
            WM_CREATE:    begin//Program  initialisation  -  just  set  up  a  tray  icon 
                                        NID.cbSize                      :=  SizeOf(NID); 
                                        NID.Wnd                            :=  Wnd; 
                                        NID.uID                            :=  1; 
                                        NID.uFlags                      :=  nif_Message  or  nif_Icon  or  nif_Tip; 
                                        NID.uCallBackMessage  :=  WM_User; 
                                        NID.hIcon                        :=  LoadIcon(hInstance,  'TRAYICON'); 
                                        Lstrcpy(NID.szTip,'Pontifex  for  Windows'); 
                                        Shell_NotifyIcon(nim_Add,  @NID); 
                                    end;