随笔分类 -  Windows编程学习笔记

《Windows游戏编程大师技巧》的读书笔记。
Windows编程-基本图元(4)
摘要:绘制圆形 阅读全文
posted @ 2013-02-19 22:51 GreenLight 阅读(142) 评论(0) 推荐(0)
Windows编程-基本图元(3)
摘要:绘制矩形 The Rectangle function draws a rectangle. The rectangle is outlined by using the current pen and filled by using the current brush. BOOL Rectangle( _In_ HDC hdc, _In_ int nLeftRect, _In... 阅读全文
posted @ 2013-02-19 22:49 GreenLight 阅读(230) 评论(0) 推荐(0)
Windows编程-基本图元(2)
摘要:关于线段的绘制 这里我们主要使用两个函数来完成MoveToEx函数和LineTo函数。 MoveToEx The MoveToEx function updates the current position to the specified point and optionally returns the previous position. BOOL MoveToEx( _In_... 阅读全文
posted @ 2013-02-19 21:39 GreenLight 阅读(245) 评论(0) 推荐(0)
Windows编程-基本图元(1)
摘要:(1)绘制点 利用GDI绘制点的时候不需要画笔和画刷。利用函数SetPixel。 The SetPixel function sets the pixel at the specified coordinates to the specified color. COLORREF SetPixel( _In_ HDC hdc, _In_ int X, _In_ int Y,... 阅读全文
posted @ 2013-02-17 17:37 GreenLight 阅读(229) 评论(0) 推荐(0)
Windows编程-windows GDI基本概念 画笔 画刷
摘要:其中关于windows GDI的描述如下: Purpose The Microsoft Windows graphics device interface (GDI) enables applications to use graphics and formatted text on both the video display and the printer. Windows-based a... 阅读全文
posted @ 2013-02-17 14:23 GreenLight 阅读(2003) 评论(0) 推荐(0)
Windows编程-自己发送消息
摘要:这里我们讨论两种消息传递的方法:SendMessage()和PostMessage(); (1)SendMessage Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does ... 阅读全文
posted @ 2013-02-12 23:35 GreenLight 阅读(1541) 评论(0) 推荐(0)
Windows编程-处理鼠标事件
摘要:我们这里仅讨论两个简单的消息: WM_MOUSEMOVE和WM_*BUTTON*。Parameters:wParam Indicates whether various virtual keys are down. This parameter can be one or more of the following values. ValueMeaning MK_CONTROL 0x0008The CTRL key is down.MK_LBUTTON 0x0001 The left mouse button is down.MK_MBUTTON 0x0010 The middle mouse 阅读全文
posted @ 2013-02-12 20:52 GreenLight 阅读(6337) 评论(0) 推荐(0)
Windows编程-处理键盘事件(2)
摘要:关于WM_KEYDOWN的消息中传递的是该键的虚拟扫描码,不是ASCII码。它传递了键被按下时的特征,细节的描述如下:wParamThe virtual-key code of the nonsystem key. See Virtual-Key Codes.lParamThe repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following.例如,我们实现一个打印输入的virtual code的程序,只 阅读全文
posted @ 2013-02-12 18:36 GreenLight 阅读(476) 评论(0) 推荐(0)
Windows编程-处理键盘事件(1)
摘要:主要有下面三种方式访问键盘的消息:(1) WM_CHAR (2) WM_KEYDOWN 和WM_KEYUP (3) GetAsyncKeyState()。 当键盘上的"A”被按下的时候,会产生两种数据: (1) ASCII (2) Scan Code ,扫描码。其中,ASCII码会区分A和a两种不同的形式。 Scan code不会区别他们。首先,我们介绍WM_CHAR的消息。 可以查看MSDN... 阅读全文
posted @ 2013-02-12 17:01 GreenLight 阅读(3215) 评论(0) 推荐(0)
Windows编程- hdc和hwnd的区别
摘要:hWnd是窗口句柄,其中包含窗口的属性。例如,窗口的大小,显示位置,父窗口。hDC(Handle to Device Context)是图像的设备描述表,窗口显示上下文句柄,其中可以进行图形显示。利用hDC=GetDC(hWnd),可以获得一个窗口的图形设备描述表。可以通过ReleaseDC()函数释放。 下面的例子是获得图形设备表,并在窗口中打印text文本。 执行的结果,如下图。程序不停的执... 阅读全文
posted @ 2013-02-11 23:50 GreenLight 阅读(6471) 评论(0) 推荐(0)