zoukankan      html  css  js  c++  java
  • 全用api写的程序

    全用api写的程序

    #include <windows.h>
    #include <stdio.h>
    #include <TCHAR.h>
    LRESULT CALLBACK winsProc(         
     HWND hwnd,
        UINT uMsg,
        WPARAM wParam,
        LPARAM lParam
    );


    int WinMain(         
       HINSTANCE hInstance,
        HINSTANCE hPrevInstance,
        LPSTR lpCmdLine,
        int nCmdShow
    )
    {
     WNDCLASS wclass;
     wclass.cbClsExtra=0;
     wclass.cbWndExtra=0;
     wclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
     wclass.hCursor=LoadCursor(NULL,IDC_ARROW);
     wclass.hIcon=LoadIcon(NULL,IDI_ERROR);
     wclass.hInstance=hInstance;
     wclass.lpfnWndProc=winsProc;
     wclass.lpszClassName=_T("Wins32");
     wclass.lpszMenuName=NULL;
     wclass.style=CS_HREDRAW|CS_VREDRAW;
     RegisterClass(&wclass);

     HWND hwnd;
     hwnd=CreateWindow(_T("Wins32"),_T("linkwork"),
      WS_OVERLAPPEDWINDOW,0,0,800,600,NULL,NULL,hInstance,NULL);

     ShowWindow(hwnd,SW_SHOWNORMAL);

     UpdateWindow(hwnd);
     MSG msg;
     BOOL bRet;

    while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
    {
        if (bRet == -1)
        {
            // handle the error and possibly exit
        }
        else
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

     return 0;


    }
    LRESULT CALLBACK winsProc(
      HWND hwnd,
      UINT uMsg,
      WPARAM wParam,
      LPARAM lParam
      )
    {
     HDC dc;
     PAINTSTRUCT ps;
     switch(uMsg)
     {

     case WM_PAINT:
      dc=BeginPaint(hwnd,&ps);
      TextOut(dc,20,20,_T("Hello Word!"),10);
      EndPaint(hwnd,&ps);
      break;
     case WM_CLOSE:
      DestroyWindow(hwnd);
     case WM_DESTROY:
      PostQuitMessage(0);
     default:
      return DefWindowProc(hwnd,uMsg,wParam,lParam);
     
     }

     return 0;
    }

  • 相关阅读:
    网络编程之Tcp,udp
    网络编程简介
    面向对象之高级篇 反射,元类
    面向对象 高级篇
    面向对象,继承
    初识面向对象
    包 hashlib,logging
    模块
    Dango生命周期回顾与forms组件
    Django中auth登录、注册、修改密码、退出、ORM自关联
  • 原文地址:https://www.cnblogs.com/ahuo/p/648024.html
Copyright © 2011-2022 走看看