之前没有认真学习过Win CE的应用,这次在当当上买了本windows ce 6.0开发者参考,同济大学何宗键老师翻译的。
刚刚读第一部分入门,几乎和所有的书籍一样,从Hello World开始,呵呵。主要是windows编程的一些基础。
一个简单的windows程序,主要有:注册窗口类、创建窗口、消息循环和窗口过程几部分组成。主要的是对窗口过程的编写。
作者提出了一个很好的模板:
这一章节有好几个例子,不过都是按照作者的这个模板来写的,所以他们的不同即是在窗口过程函数部分。
PS:有个问题,drawtext函数中,使用了rect的引用,rect,我查了,是个结构体,有四个成员变量:left,top,right,bottom,我的理解是前两者是矩形左上角顶点的左边,后两者是右下角顶点的左边。不知道是否正确?
今天查msdn中rect结构体的成员变量:x,y,weigth,higth,其中,x,y是原点的坐标(左上角),后两者是高度和宽度,何解?
刚才又查了一下msdn:
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
typedef struct _RECT { LONG left; LONG top; LONG right; LONG bottom; } RECT, *PRECT;
Members
- left
- Specifies the x-coordinate of the upper-left corner of the rectangle. top
- Specifies the y-coordinate of the upper-left corner of the rectangle. right
- Specifies the x-coordinate of the lower-right corner of the rectangle. bottom
- Specifies the y-coordinate of the lower-right corner of the rectangle.
我的理解是正确的。