学习VC++深入浅出——DLL的使用
2008-03-19 23:52
232 查看
学习VC++深入浅出——DLL的使用
//#include <Windows.h>
//#include <stdio.h>
extern "C" _declspec(dllexport) int add(int a,int b)
...{
return a+b;
}
_declspec(dllexport) int subtract(int a,int b)
...{
return a-b;
}
/**//*
class _declspec(dllexport) Point
{
public:
void output(int x,int y)
{
HWND hwnd = GetForegroundWindow();
HDC hdc=GetDC(hwnd);
char buf[20];
memset(buf,0,20);
sprintf(buf,"x=%d,y=%d",x,y);
TextOut(hdc,0,0,buf,strlen(buf));
ReleaseDC(hwnd,hdc);
}
};
*/
_declspec(dllimport) int add(int a,int b);
_declspec(dllimport) int subtract(int a,int b);
extern int add(int a,int b);
extern int subtract(int a,int b);
//extern class Point;
//_declspec(dllimport) int add(int a,int b);
//_declspec(dllimport) int subtract(int a,int b);
//#include "..Dll1Dll1.h"
void CDllTestDlg::OnBtnAdd()
...{
// TODO: Add your control notification handler code here
CString str;
str.Format("5+3=%d",add(5,3));
MessageBox(str);
}
void CDllTestDlg::OnBtnSubtract()
...{
// TODO: Add your control notification handler code here
CString str;
str.Format("5-3=%d",subtract(5,3));
MessageBox(str);
}
void CDllTestDlg::OnBtnOutput()
...{
// TODO: Add your control notification handler code here
// Point pt;
// pt.output(5,3);
}
//#include <Windows.h>
//#include <stdio.h>
extern "C" _declspec(dllexport) int add(int a,int b)
...{
return a+b;
}
_declspec(dllexport) int subtract(int a,int b)
...{
return a-b;
}
/**//*
class _declspec(dllexport) Point
{
public:
void output(int x,int y)
{
HWND hwnd = GetForegroundWindow();
HDC hdc=GetDC(hwnd);
char buf[20];
memset(buf,0,20);
sprintf(buf,"x=%d,y=%d",x,y);
TextOut(hdc,0,0,buf,strlen(buf));
ReleaseDC(hwnd,hdc);
}
};
*/
_declspec(dllimport) int add(int a,int b);
_declspec(dllimport) int subtract(int a,int b);
extern int add(int a,int b);
extern int subtract(int a,int b);
//extern class Point;
//_declspec(dllimport) int add(int a,int b);
//_declspec(dllimport) int subtract(int a,int b);
//#include "..Dll1Dll1.h"
void CDllTestDlg::OnBtnAdd()
...{
// TODO: Add your control notification handler code here
CString str;
str.Format("5+3=%d",add(5,3));
MessageBox(str);
}
void CDllTestDlg::OnBtnSubtract()
...{
// TODO: Add your control notification handler code here
CString str;
str.Format("5-3=%d",subtract(5,3));
MessageBox(str);
}
void CDllTestDlg::OnBtnOutput()
...{
// TODO: Add your control notification handler code here
// Point pt;
// pt.output(5,3);
}
相关文章推荐
- 学习VC++深入浅出——命名管道的使用
- 学习VC++深入浅出——剪贴板的使用
- [转]C++学习:VC++动态链接库(DLL)编程深入浅出(zz)
- 学习VC++深入浅出——ADO的使用
- 学习VC++深入浅出——ADO的使用
- 学习VC++深入浅出——匿名管道的使用
- VC++动态链接库(DLL)编程深入浅出(一)
- 使用vc++ 6.0制作dll,并在java程序中使用(转)
- 转:VC调用vbscript.dll使用其正则表达式库
- vc编写供vb使用的dll文档
- VC++动态链接库(DLL)编程深入浅出(四)(转)
- 在vc中的regular dll中使用ado的导入问题
- VC深入浅出学习笔记(一)
- Dll学习二_Dll 窗体中动态创建数据并使用Demo
- VC++动态链接库(DLL)编程深入浅出(zz)
- (转)VC++动态链接库(DLL)编程深入浅出(一)
- 使用vc2008创建dll(c#调用)
- [今天的编程日记, 在vb中使用vc编译的dll实例]
- VC 生成Dll 并使用
- VC学习笔记 -单选按钮控件(Ridio Button)的使用