首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

api写的程序(没有form)怎么更改程序的图标

2012-02-06 
api写的程序(没有form)如何更改程序的图标?api写的程序(没有form)如何更改程序的图标?代码如下:programmin

api写的程序(没有form)如何更改程序的图标?
api写的程序(没有form)如何更改程序的图标?
代码如下:
program   miniapp;
uses
    Windows,
    Messages;

{$R   *.res}
const
    szAppName   :   PChar   =   'MiniApp ';
function   WndProc(AWnd:HWND;   message:UINT;   wp:WPARAM;   lp:LPARAM):LRESULT;stdcall;
begin
    Result   :=   0;
    case   message   of
        WM_DESTROY:
              PostQuitMessage(0);
        else
              Result   :=   DefWindowProc(AWnd,   message,   wp,   lp);
    end;
end;
 
var
    wc   :   WNDCLASS;
    HMainWnd   :   HWND;
    AMsg   :   MSG;
    myreg:tregistry;
begin
    with   wc   do   begin
        style   :=   CS_VREDRAW   or   CS_HREDRAW;
        lpfnWndProc   :=   @WndProc;
        cbClsExtra   :=   0;
        cbWndExtra   :=   0;
        hIcon   :=   LoadIcon(0,   IDI_APPLICATION);
        hCursor   :=   LoadCursor(0,   IDC_ARROW);
        hbrBackground   :=   GetSysColorBrush(COLOR_WINDOW);
        hInstance   :=   HInstance;
        lpszMenuName   :=   nil;
        lpszClassName   :=   szAppName;
    end;
    RegisterClass(wc);
 
    HMainWnd   :=   CreateWindow(szAppName,
                                                      szAppName,
                                                      WS_OVERLAPPEDWINDOW,
                                                      Integer(CW_USEDEFAULT),   Integer(CW_USEDEFAULT),
                                                      Integer(CW_USEDEFAULT),   Integer(CW_USEDEFAULT),
                                                      HWND_DESKTOP,   0,
                                                      HInstance,   nil);
    ShowWindow(HMainWnd,   CmdShow);
    UpdateWindow(HMainWnd);
    while   GetMessage(AMsg,   0,   0,   0)   do   begin
        TranslateMessage(AMsg);
        DispatchMessage(AMsg);
    end;


end.

[解决办法]
就是改这个啊:hIcon := LoadIcon(0, IDI_APPLICATION);
[解决办法]
参考这个demo
D:\Program Files\Borland\Delphi7\Demos\ResXplor

热点排行