windowdemo.dpr

来自「含此文档只表示此压缩包来自于DELPHI盒子网站 ------------」· DPR 代码 · 共 72 行

DPR
72
字号
////////////////////////////////////////////////////////////////////////////////
//
//
//  FileName    :   WindowDemo.dpr
//  Creator     :   Shen Min
//  Date        :   2002-3-2
//  Comment     :   Create Window Demo for <<delphi after high hand>>
//
//
////////////////////////////////////////////////////////////////////////////////

program WindowDemo;

uses Windows, Messages;

function WindowProc(hwnd : HWND; uMsg : Cardinal; wParam : WPARAM; lParam : LPARAM) : LResult; stdcall;
begin
    Result := 0;
    case uMsg of

    WM_CLOSE : PostMessage(hwnd, WM_QUIT, 0, 0);

    WM_LBUTTONDOWN : MessageBox(hwnd, 'Hello!', '和您打个招呼', MB_ICONINFORMATION);

    else
        Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
    end;
end;

var
    wndcls : WNDCLASS;
    hWnd : THandle;
    Msg : tagMSG;
begin
    wndcls.style         := CS_DBLCLKS;
    wndcls.lpfnWndProc   := @WindowProc;
    wndcls.cbClsExtra    := 0;
    wndcls.cbWndExtra    := 0;
    wndcls.hInstance     := hInstance;
    wndcls.hIcon         := 0;
    wndcls.hCursor       := LoadCursor(hInstance, 'IDC_ARROW');
    wndcls.hbrBackground := COLOR_WINDOWFRAME;
    wndcls.lpszMenuName  := nil;
    wndcls.lpszClassName := 'WindowClassDemo';
    if RegisterClass(wndcls) = 0 then
        Exit;

    hWnd := CreateWindow(
        'WindowClassDemo',
        'WindowDemo',
        WS_BORDER or WS_CAPTION or WS_SYSMENU,
        Integer(CW_USEDEFAULT),
        Integer(CW_USEDEFAULT),
        Integer(CW_USEDEFAULT),
        Integer(CW_USEDEFAULT),
        0,
        0,
        hInstance,
        nil
    );
    if hWnd = 0 then
        Exit;
    ShowWindow(hWnd, SW_SHOWNORMAL);
    UpdateWindow(hWnd);

    while GetMessage(Msg, hWnd, 0, 0) do
    begin
        TranslateMessage(Msg);
        DispatchMessage(Msg);
    end;
end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?