• Object Pascal开发windows原生程序


    program Project1;

    uses
      Windows ,Messages ,SysUtils;
    const
      appname='fancydemo';
      function windowproc(window:HWND ;amessage:UINT ;wparam:WPARAM ;
      lparam:LPARAM ):LRESULT ;stdcall ;export ;
      var
        dc:HDC ;
        ps:TPaintStruct ;
        r:TRect ;

    begin
      windowproc:=0;
      case amessage of
      WM_PAINT :
      begin
        dc:=BeginPaint(window ,ps);
        GetClientRect(window ,r);
        DrawText(dc,'op 语言写的windows程序',-1,r,DT_SINGLELINE or DT_CENTER );
        EndPaint(window ,ps);
        exit;
      end;
      WM_DESTROY :
      begin
        PostQuitMessage(0);
        Exit;
      end;
      end;
      windowproc:=DefWindowProc(window,amessage ,wparam ,lparam );
    end;
         function winregister:Boolean ;
         var
           windowclass:WNDCLASS ;
           begin
             windowclass .style :=CS_HREDRAW or CS_VREDRAW ;
             windowclass .lpfnWndProc :=TFNWndProc(@windowproc);
             windowclass .cbClsExtra :=0;
             windowclass .cbWndExtra :=0;
             windowclass .hInstance :=SYSTEM.MainInstance ;
             windowclass .hIcon :=LoadIcon(0,IDI_APPLICATION );
             windowclass .hCursor :=LoadCursor(0,IDC_ARROW );
             windowclass .hbrBackground :=GetStockObject(WHITE_BRUSH );
             windowclass .lpszMenuName :=nil;
             windowclass .lpszClassName :=appname ;
             result:=RegisterClass(windowclass )<>0;
           end;
           function wincreate:HWND ;
           var
            hwindow:HWND ;
            begin
              hwindow :=CreateWindow(appname ,'hello,fancy',WS_OVERLAPPEDWINDOW ,CW_usedefault,cw_usedefault,cw_usedefault,cw_usedefault,0,0,SYSTEM.MainInstance ,nil );
              if hwindow <> 0 then
                 begin
                   ShowWindow(hwindow ,cmdshow);
                   ShowWindow(hwindow ,SW_SHOW );
                   UpdateWindow(hwindow );
                 end;
                   Result :=hwindow ;
            end;
            var
               amessage:TMsg ;
               hwindow:HWND ;
             begin
               if not winregister then
               begin
                MessageBox(0,'Register failed',nil,MB_OK );
                Exit;
               end;
               hwindow:=wincreate ;
               if LongInt (hwindow)=0 then
               begin
               MessageBox(0,'wincreate failed',nil,MB_OK );
               Exit ;
               end ;
               while GetMessage(amessage ,0,0,0) do
               begin
               TranslateMessage(amessage );
               DispatchMessage(amessage );
               end;
               Halt (amessage .wParam );
             end.


     

  • 相关阅读:
    Failed at the node-sass@4.13.1 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    页面跳转
    多行文字溢出显示省略号
    iview-select选择器组件的使用&设置默认选中的值
    iview中表单验证(遇到的问题)
    iview DatePicker type 为dateTime 时无法做表单验证!
    报错:[Vue warn]: Error in callback for watcher "value": "Value should be trueValue or falseValue."
    Jquery 数字滚动兼容小数
    validate表单验证-单独验证
    2020软件工程作业03
  • 原文地址:https://www.cnblogs.com/feng801/p/1277788.html
Copyright © 2020-2023  润新知