- 热门文章:
- · VC Studio 使用技巧大全
- · 用PHP 4.2书写安全的脚本
- · 限制只能中文输入的方法
- · 程序设计中的一些感悟
- · 编写高质量的VB代码
- · dvbbs绝对背后的微笑
- · 5.PHP的其他功能
- · 4.与数据库的连接
- · 3.从实例开始
- · 2.PHP入门
- · 1.PHP简介
- · 随机头像PHP版
上一篇:SQL Server 2000的安全配置 >>
VC里一些容易混淆的地方
false/true是标准c++语言里新增的关键字,而false/true是通过#define,这要用途是解决程序在c与c++中环境的差异,以下是false/true在windef.h的定义:
#ifndef false
#define false 0
#endif
#ifndef true
#define true 1
#endif
也就是说false/true是int类型,而false/true是bool类型;所以两者不一样的,只不过我们在使用中没有这种感觉,因为c++会帮你做隐式转换。
2.bool的大小与bool的区别:
bool在c++里是占用1字节,而bool是int类型,int类型的大小是视具体环境而定的;所以来说:false/true只占用1个字节,而true/false视具体环境而言,以下是bool在windef.h中的定义:typedef int bool;
3.null与0的区别:
还是让我们看一下windef.h中null的定义:
#ifndef null
#ifdef __cplusplus//这个是指示是用c++来编译程序
#define null 0
#else
#define null ((void *)0)
#endif
#endif
所以说:它们没有区别,只不过在c里面会做一个强制类型转换。
4.hinstance与hmodule的区别:
在windef.h中的定义:
typedef hinstance hmodule; /* hmodules can be used in place of hinstances */
5.callback,winapi的实质:
在windef.h中的定义:
#undef far
#undef near
#undef pascal
#define far
#define near
#if (!defined(_mac)) && ((_msc_ver >= 800) || defined(_stdcall_supported))
#define pascal __stdcall
#else
#define pascal
#endif
#if defined(doswin32) || defined(_mac)
#define cdecl _cdecl
#ifndef cdecl
#define cdecl _cdecl
#endif
#else
#define cdecl
#ifndef cdecl
#define cdecl
#endif
#endif
#ifdef _mac
#define callback pascal
#define winapi cdecl
#define winapiv cdecl
#define apientry winapi
#define apiprivate cdecl
#ifdef _68k_
#define pascal __pascal
#else
#define pascal
#endif
#elif (_msc_ver >= 800) || defined(_stdcall_supported)
#define callback __stdcall
#define winapi __stdcall
#define winapiv __cdecl
#define apientry winapi
#define apiprivate __stdcall
#define pascal __stdcall
#else
#define callback
#define winapi
#define winapiv
#define apientry winapi
#define apiprivate
#define pascal pascal
#endif
6.一些常见类型的定义:
在windef.h中的定义:
typedef uint wparam;
typedef long lparam;
typedef long lresult;
typedef int int;
typedef unsigned int uint;
typedef unsigned long dword;
typedef int bool;
typedef unsigned char byte;
typedef unsigned short word;
typedef float float;
typedef unsigned long ulong;
typedef unsigned short ushort;
typedef unsigned char uchar;
typedef char *psz;
7.常见window资源类型的实质:
在windef.h中的定义:
declare_handle(hpen);
declare_handle(hbitmap);
declare_handle(hbrush);
declare_handle(hdc);
declare_handle(hfont);
declare_handle(hicon);
declare_handle(hmenu);
declare_handle(hmetafile);
declare_handle(hinstance);
declare_handle(hpalette);
typedef word atom;
typedef handle hglobal;
typedef handle hlocal;
typedef handle globalhandle;
typedef handle localhandle;
typedef hicon hcursor; /* hicons & hcursors are polymorphic */
typedef dword colorref;
在windowsx.h中:
#define declare_handle32 declare_handle
penwin.h:
#ifndef declare_handle32
#define declare_handle32(name)\
struct name##__ { int unused; };\
typedef const struct name##__ far* name
#endif //!declare_handle32
6.platform的编译版本的相关预处理宏:
macro description
__cplusplus defined for c++ programs only.
_mfc_ver defines the mfc version. defined as 0x0421 for microsoft foundation class library 4.21. always defined.
_msc_ver defines the compiler version. defined as 1200 for microsoft visual c++ 6.0. always defined.
_win32 defined for applications for win32®. always defined.
()
下一篇:VC Studio 使用技巧大全 >>
相关文章:
- · 自动跳转中英文页面
- · 从IIS到SQL Server数据库安全
- · 通用数据库显示程序
- · ASP实用函数库
- · 漂亮但不安全的CTB
- · 无组件图片与文本同步存入数据库的最简单的办法
- · 利用PHP创建动态图像
- · 精妙SQL语句
- · 用ASP动态生成JS表单验证代码
- · 用ASP编写网上调查投票系统
- · 轮换的logo显示
- · ip签名探针
- · ASP下载系统防盗链方法
- · ASP开发网页牢记注意事项
- · IIS6.0下ASP的新增功能
- · 图片或banner的随机显示
- · 判断Cookies是否处于开启状态
- · 主页javascript特效19则
- · Script经典文章
- · 用ASP做全文检索
- · WEB应用中报表打印的实现
- · 控制输出字符串长度区别中英文
- · ADO连接数据库字符串大全
- · vbscript与javascript传递变量
- · WSH 直接将查询数据结果生成EXCEL表
- · 树型结构在ASP中的简单解决
- · 用Object for OLE访问Oracle
- · ASP中使用SQL语句
- · 继承派生多态
- · ASP中处理#include
- · 编写自己的缓冲区溢出利用程序
- · PHP4.23在WindowsXP下的IIS和Apache2两种服务器上的安装实例
- · 前后左右出现的窗口
- · 点击右键就弹出一个菜单
- · 不出提示窗口关闭窗口
- · 实现打印设置与预览
- · 如何判断ACTIVEX控件是否下载
- · 用Js判断输入的时间是否有效
