• NativeWindow_01


    1、

      “{$O-}”关闭优化

      “{$O-}”打开优化

    2、

    unit NativeWindow;
    
    interface
    
    uses
      Windows, Messages, SysUtils;
    
    procedure CreateWindow;
    
    implementation
    
    function ProcWindow(_hWnd :HWND;
                        _uMsg :UINT;
                        _wParam :WPARAM;
                        _lParam :LPARAM):longint;stdcall;
    var
      hDc1 :HDC;
      ps :PAINTSTRUCT;
    begin
      if (_uMsg = WM_LBUTTONUP) then
      begin
        MessageBox(0, 'Up', '1', 0);
      end
      else if (_uMsg = WM_PAINT) then
        begin
        hDc1 := BeginPaint(_hWnd, ps);
        TextOut(hDc1, 0, 0, 'ASDFG zxcvb', strlen('ASDFG zxcvb'));
        EndPaint(_hWnd, ps);
        Result := 0;
        Exit;
        end
      else if (_uMsg = WM_DESTROY) then
      begin
        DestroyWindow(_hwnd);
        PostQuitMessage(0);
      
        Result := 0;
        Exit;
      end;
      Result := DefWindowProc(_hWnd, _uMsg, _wParam, _lParam);
    end;
    
    {$O-}
    procedure CreateWindow;
    var wndcls :WNDCLASS;
        hInstance :THandle;
        hWnd1 :HWND;
        iErr :integer;
    begin
      hInstance := Windows.GetModuleHandle(nil);
    
      ZeroMemory(@wndcls, sizeof(wndcls));
        wndcls.cbClsExtra    := 0;
        wndcls.cbWndExtra    := 0;
        wndcls.hbrBackground := HBRUSH(GetStockObject(WHITE_BRUSH));    // 背景画刷
        wndcls.hCursor        := LoadCursor(0, IDC_CROSS);
        wndcls.hIcon        := LoadIcon(0, IDI_ERROR);    // 窗口图标
        wndcls.hInstance    := hInstance;
        wndcls.lpfnWndProc    := @ProcWindow;
        wndcls.lpszClassName:= 'zc20110929';
        wndcls.lpszMenuName := nil;
        wndcls.style        := CS_HREDRAW or CS_VREDRAW;
      RegisterClass(wndcls);
    
      hWnd1 := CreateWindowEx(
            WS_EX_CLIENTEDGE,
            wndcls.lpszClassName,
            'ZC Window',
            WS_OVERLAPPEDWINDOW,
            100, 100,
            400, 300,
            0,
            0, //g_hMenu,
            hInstance,
            0);
      if (hWnd1 = 0) then
        iErr := GetLastError;
    
    //    ShowWindow(hWnd1, SW_SHOWNORMAL);
        UpdateWindow(hWnd1);
    end;
    {$O+}
    
    end.

    3、

  • 相关阅读:
    vsftpd用户登陆目录
    Linux下能否用用apache运行ASP.NET的WebService
    rose软件下载(Rational Rose 2003 Enterprise Edition)
    linux删除目录
    2013314 生活日记
    ubuntu12.10安装GTK+
    SqlServer 基础知识数据检索、查询排序
    获取时间段:本周、本月、本年
    二、自定义控件之RadioButtonList
    ext.net 开发学习之FileUploadField与Image (四)
  • 原文地址:https://www.cnblogs.com/CodeSkill/p/6099954.html
Copyright © 2020-2023  润新知