90 likes | 219 Views
Win32SDK 开发指南专题. 什么是 WinSDK: 大致说来 windows 编程有两种方法: 1.windwos 方式( SDK ) 2.c++ 方式 : 即对 SDK 函数进行包装,如 VC 的 MFC, 如果要深入 下去,还是要熟悉 SDK 。. 两种方法有哪些区别呢: SDK 编程就是直接调用 windows 的 API 进行编程,但是有上千个 API 组成 (windows 的 API 有两千多个 ) ,这种数目太大了,对于编程显然不利。
E N D
什么是WinSDK:大致说来windows编程有两种方法: 1.windwos方式(SDK) 2.c++方式:即对SDK函数进行包装,如VC的MFC, 如果要深入 下去,还是要熟悉SDK。
两种方法有哪些区别呢:SDK编程就是直接调用windows的API进行编程,但是有上千个API组成(windows的API有两千多个),这种数目太大了,对于编程显然不利。两种方法有哪些区别呢:SDK编程就是直接调用windows的API进行编程,但是有上千个API组成(windows的API有两千多个),这种数目太大了,对于编程显然不利。 而MFC把这些API封闭起来,共有一百多个类组成。一般只需20多个windows类和另外20多个通用的非windows类就可"干活"了,这一改变无疑是有很大好处的。尽管MFC如此方便,但是要学VC,直接去学MFC却是不明智的选择。
再加深几点概念 • 什么是API:API,全称application program interface,意思是应用程序编程接口,Windows支持的API叫Win API,WinAPI就是应用程序和windows之间通讯的一个编程界面。API实际是操作系统留给应用程序的一个调用接口,应用程序通过调用操作系统的 API 而使操作系统去执行应用程序的命令以方便程序员来编写应用程序。进行系统编程,API是必不可少的。API是每个VC高手的必过的一关。
什么是WinSDK编程:WinSDK程序设计就是API方式的windows程序设计。SDK,全称Software Developers Kit,意思是软件开发工具箱。它是在windows程序设计早期,程序员进行windows程序设计所必须购买的一个软件包。WinSDK编程一定要学习,直接接触底层代码对MFC源码的理解是有很大好处的。
SDK Data Types • BOOLA Boolean value. • BSTRA 32-bit character pointer. • BYTEAn 8-bit integer that is not signed. • COLORREFA 32-bit value used as a color value. • DWORDA 32-bit unsigned integer or the address of a segment and its associated offset. • LONGA 32-bit signed integer. • LPARAMA 32-bit value passed as a parameter to a window procedure or callback function. • LPCSTRA 32-bit pointer to a constant character string. • LPSTRA 32-bit pointer to a character string.
SDK Data Types • LPCTSTRA 32-bit pointer to a constant character string that is portable for Unicode and DBCS. • LPTSTRA 32-bit pointer to a character string that is portable for Unicode and DBCS. • LPVOIDA 32-bit pointer to an unspecified type. • LRESULTA 32-bit value returned from a window procedure or callback function. • UINTA 16-bit unsigned integer on Windows versions 3.0 and 3.1; a 32-bit unsigned integer on Win32. • WNDPROCA 32-bit pointer to a window procedure. • WORDA 16-bit unsigned integer. • WPARAMA value passed as a parameter to a window procedure or callback function: 16 bits on Windows versions 3.0 and 3.1; 32 bits on Win32.
什么是句柄? 句柄是用来唯一标示某个对象的长整数,可以简单把句柄理解为指针,但实际上还不太一样。Windows系统定义了很多句柄,如窗口句柄、设备环境句柄等等,在MFC中都被封装起来了,因此一般看不到。但还有许多MFC中的函数沿用API的习惯,使用句柄作为函数的参数。如果使用API编程就得经常跟句柄打交道了。
什么是回调函数 用callback关键字定义。 回调函数大多只是自己定义一个名,函数体大多是系统定义好的,虽然是自己来设计,但是供windows调用的。