c语言程序设计基础wupt,c语言程序设计基础.ppt

c语言程序设计基础

char *hello="你好,这里是窗口演示程序!"; HDC hdc; // 说明设备描述句柄 PAINTSTRUCT ps; //说明用来绘制用户程序客户区所需信息的结构 //多分支结构用来根据消息的不同值进行相应的处理 switch(message) { 完整的源程序清单 case WM_PAINT: //此消息要在用户的客户区进行绘图输出 hdc=BeginPaint(hWnd,&ps); TextOut(hdc,120,100,hello,lstrlen(hello)); EndPaint(hWnd,&ps); break; case WM_DESTROY: //此消息要结束窗口过程 PostQuitMessage(0); break; default: // 默认情况下,系统处理余下的消息 return (DefWindowProc(hWnd,message,wParam,lParam)); } UpdateWindow发出 WM_PAINT An application sends the WM_PAINT message when the system or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function. WM_PAINT hdc = (HDC) wParam; // the device context to draw in Parameters hdc Handle to the device context to draw in. If this parameter is NULL, use the default device context. This parameter is used by some common controls to enable drawing in a device context other than the default device context. Other windows can safely ignore this parameter. Return Values An application returns zero if it processes this message. wcex.style =CS_HREDRAW|CS_VREDRAW; // 窗口风格 wcex.lpfnWndProc=(WNDPROC)MainWndProc; // 窗口函数过程 wcex.cbClsExtra =0; // 类变量占用的附属存储空间 wcex.cbWndExtra =0; // 实例变量占用的附属存储空间 wcex.hInstance =hInstance; // 模块句柄,用于系统操作本程序 wcex.hIcon =LoadIcon(NULL, IDI_APPLICATION); // 图标对象句柄 wcex.hCursor =LoadCursor(NULL,IDC_ARROW); // 光标对象句柄 wcex.hbrBackground =GetStockObject(WHITE_BRUSH); // 刷子对象 wcex.lpszMenuName = NULL; // 菜章对象字符串 wcex.lpszClassName ="DemoWClass"; // 标识类名字的串 ”DIALOGMENU” 将菜单标识符在定义窗口类时挂上 ”DIALOGMENU” ABOUTBOX DIALOG DISCARDABLE 20, 25, 124, 77 STYLE DS_MODALFRAME | DS_3DLOOK | DS_CONTRO

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值