摘要:
jiurl键盘驱动 3......
摘要:
外星代码生成术之逗号运算符
缩减代码不意味着增加可读性,恰恰相反,过分的缩减代码反而会使代码更难懂,难以维护。本文不提倡滥用扭曲化的外星c语法,只是作为一个集趣式的记录,为初学c派系语言的读者简单介绍一下那些莫名其妙的代码是如何造出来的。
c派系语言为我们提供了许许多的奇怪的运算符,最奇怪的运算符之一当数逗号运算符,它本身并没有太多实际意义“运算”,只是计算各个运算项的值,然后......
Developing COM Components using VC-ATL(2-5)
对组件的十一个文件的剖析
代码选取 【程序编程相关:
编写驱动拦截NT的API实现隐藏文件目录】
一.stdafx.h 【推荐阅读:
提取网页所有链接】
… 【扩展信息:
用Visual C++编写电子邮件程序】
#define strict
#ifndef _win32_winnt
#define _win32_winnt 0x0400
#endif
#define _atl_apartment_threaded
#include <afxwin.h>
#include <afxdisp.h>
#include <atlbase.h>
//you may derive a class from ccommodule and use it if you want to override
//something, but do not change the name of _module
extern ccommodule _module;
#include <atlcom.h>
…
代码剖析
n 包含了atl头文件
#include <atlbase.h>
#include <atlcom.h>
n 两个声明
#define _atl_apartment_threaded
定义了将成为apartment模型的dll默认线程模型.
_module是ccommodule类型的对象,ccommodule实现了com服务器的基本功能,实现并提供了诸如注册.实例化所支持对象以及通过对象映射管理生命周期等服务.注意因为它通过atl头文件所引用,所以ccommodule对象必须是全局的且必须命名为_module.
另外,这个类也是atl的中心,正如主函数对任何程序的入口点(c/c++),这个类的模块对象处理几个任务,如:服务器锁计数.注册本地服务器的类工厂.根据注册表注册与反注册.
二.stdafx.cpp
…
#ifdef _atl_static_registry
#include <statreg.h>
#include <statreg.cpp>
#endif
#include <atlimpl.cpp>
三.myproj.def输出定义文件
代码选取
; myproj.def : declares the module parameters.
library "myproj.dll"
exports
dllcanunloadnow @1 private...
下一页 摘要:
以下是字符串类型的含义(图示)
+================================================================+
lp|c|w|t|str
long pointer^ constant^ wide^ generic^ string^
==================================================......