Dragon  
Dragon
日历
<2008年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
统计
  • 随笔 - 58
  • 文章 - 0
  • 评论 - 55
  • 引用 - 0

导航

常用链接

留言簿(3)

随笔分类(58)

随笔档案(58)

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 

在MFC中全局函数的添加可以这样:
   先创建一个头文件,专放函数的声明,然后再创建一个实现文件(CPP),专放函数的实现.
如我今天所创建的如下:
头文件:
#include "stdafx.h"//注意要加这个
unsigned int HashOf(CString Str);
//加密
CString Encrypt(CString Str);
//解密
CString UnEncrypt(CString Str);

实现文件:
#include "stdafx.h"//注意也要加这个
#include "Security.h"
unsigned int HashOf(CString Str)
{
 int i, key;
 key = 0;
 for(i = 0; i < Str.GetLength(); i++)
 {
  key = ((key << 2) | (key >> 30))^(Str.GetAt(i));
 }
 return key;
};
//加密
CString Encrypt(CString Str)
{
 return Str;
}
//解密
CString UnEncrypt(CString Str)
{
 return Str;
}

创建之后,记得在要用到这些函数的文件中包含这些文件.

posted on 2008-09-02 19:30 Dragon 阅读(712) 评论(0)  编辑 收藏 引用 所属分类: VC

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


 
Copyright © Dragon Powered by: 博客园 模板提供:沪江博客