zoukankan
html css js c++ java
MFC如和将类封装到DLL以及调用
MFC如和将类封装到DLL以及调用
分类:
C++技术
2012-06-27 17:40
1028人阅读
评论
(0)
收藏
举报
dll
fun
mfc
null
exe
*1、先用mfc向导生成静态dll文件。
*2、编辑增加类;
*3、生成dll文件和lib文件;
*4、将生成的dll和lib,和类的头文件复制到需要引用的文*件exe下;
*/
//导出dll的头文件myClass.h
#define DLLimport __declspec(dllimport)
#define DLLexprot __declspec(dllexport)
class DLLexprot myClass //导出类
{
public:
myClass(void);
~myClass(void);
void fun1();
void fun2();
};
//导出dll的cpp文件myClass.cpp
#include "StdAfx.h"
#include "myClass.h"
myClass::myClass(void)
{
}
myClass::~myClass(void)
{
}
void myClass::fun1()
{
::MessageBox(NULL,_T("fun1()"),_T("MessageBox"),MB_OKCANCEL);
}
void myClass::fun2()
{
::MessageBox(NULL,_T("fun2()"),_T("MessageBox"),MB_OK);
}
//实现调用dll文件 hello.cpp
#include "myClass.h" //引用类的头文件
#pragma comment(lib,"MFCdll.lib") //引用lib文件
#define DLLimport __declspec(dllimport)
#define DLLexport __declspec(dllexport)
class DLLimport myClass; //导入类
#include <iostream>
using namespace std;
int main()
{
cout<<"hello world!"<<endl;
myClass a;
a.fun1(); //调用类的成员函数
a.fun2();
}
查看全文
相关阅读:
HDU 5444 Elven Postman 二叉排序树
HDU 5438 Ponds dfs模拟
Gym
markdown test
Gym
集训回顾
UVALive
UVALive
UVALive
codeforcres 589 J
原文地址:https://www.cnblogs.com/jack-jia-moonew/p/4228138.html
最新文章
SharePoint 2013 配置HTTPS(SSL)
SharePoint 2013 搭建负载均衡(NLB)
清理SharePoint 2010的SQL Server 2008 R2日志数据库的方法!
sharepoint 2013基于AD的Form表单登录(三)——选择用户时,屏蔽掉AD。
史上最详细SharePoint 2013安装步骤图解新手教程
1.Office 365系列(-)
sharepoint代码添加WebPart
sharepoint:基于AD的FORM认证
SharePoint 使用代码为页面添加WebPart
HTML5 SVG
热门文章
HTML5 File API的应用
WEB存储
HTML5应用缓存与Web Workers
columns分栏与flex弹性盒模型
css经典布局之双飞翼
css3的transform ,2D变换
css3的transition过渡
css3的animation动画
css背景图
HDU 5441 Travel 并查集
Copyright © 2011-2022 走看看