《windows程序设计》文本输出(02)
2021-07-08 04:06
标签:begin The div 分享 image return struct for llb 消息循环代码如下: 《windows程序设计》文本输出(02) 标签:begin The div 分享 image return struct for llb 原文地址:https://www.cnblogs.com/YiShen/p/9744565.html
获取设备环境句柄:
方法一:
hdc = BeginPaint(hwnd, &ps);
//使用GDI函数
EndPaint(hwnd, &ps);
方法二:
hdc = GetDc(hwnd);
//使用GDI函数
ReleaseDc(hwnd, hdc)
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
TextOut(hdc,0,0,"hello world",11);
EndPaint(hwnd, &ps);
break;
default: /* for messages that we don‘t deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}