10 2013 档案
摘要:主要分两步:1、所使用的资源xxx.rc的中修改代码如下:1 // Chinese (P.R.C.) resources2 //这是中文3 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)4 #ifdef _WIN325 LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED6 #pragma code_page(936)7 #endif //_WIN321 // English (U.S.) resources2 //这是英文3 #if !defined(AFX_RESOURCE_DLL
阅读全文
摘要:1、在测试编写继承CStatic类组件时候,发现在调用调试过程中弹出一个错误,点忽略还可以继续运行。如下图:2、dlgdata.cpp此文件是VS安装目录\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\src\mfc中的文件,而出现此错误一般是所使用的组件有问题,此项目中我直接使用了自带的CStatic(caption:TODO:在此旋转对话框控件)。再添加一个CStatic(caption:Static),结果发现这两个CStatic的ID竟然是一样的IDC_STATIC,此时大约有结论了:应该是ID冲突(IDC_STATIC这个ID应该是默认绑定
阅读全文
摘要:1、VS2003新建DLL项目dllTest2、项目dllTest中添加类CDllDailog3、切换到Resource view界面,添加新Button(ID:IDC_BUTTON_Hello Caption:Hello),并点击进入DllDialog.cpp脚本,添加代码如下(红色): 1 #include "stdafx.h" 2 #include "dllTest.h" 3 #include "DllDialog.h" 4 #include ".\dlldialog.h" 5 6 7 // CDllDial
阅读全文
摘要:1、VS2003新建DLL项目dllTest2、项目dllTest中添加脚本point.h,代码如下: 1 #ifndef POINT_H 2 #define POINT_H 3 4 #ifdef DLL_FILE 5 class _declspec(dllexport) point //导出类point 6 #else 7 class _declspec(dllimport) point //导入类point 8 #endif 9 {10 public:11 float y;12 float x;13 point();14 point(float x_c...
阅读全文
摘要:1、VS2003新建DLL项目dllTest2、项目dllTest中添加脚本lib.h,代码如下: 1 #ifndef LIB_H 2 #define LIB_H 3 extern int dllGlobalVar; 4 extern "C" int GetGlobalVar(); 5 extern "C" void SetGlobalVar(int value); 6 //为了验证全局的字符变量定义导出dllGlobalStr 7 extern char *dllGlobalStr; 8 extern "C" char *GetGl
阅读全文
摘要:1、VS2003新建DLL项目dllTest2、项目dllTest中添加脚本lib.h,代码如下:1 #ifndef LIB_H2 #define LIB_H3 int _stdcall add(int x,int y);4 int _cdecl mius(int x,int y);5 #endif 3、项目dllTest中添加脚本lib.cpp,代码如下: 1 #include "lib.h" 2 #include "windows.h" 3 #include "stdio.h" 4 5 BOOL APIENTRY DllMain(
阅读全文
摘要:1、VS2003新建DLL项目dllTest2、项目dllTest中添加脚本lib.h,代码如下:1 #ifndef LIB_H2 #define LIB_H3 extern "C" int add(int x,int y);4 extern "C" int mius(int x,int y);5 #endif 3、项目dllTest中添加脚本lib.cpp,代码如下: 1 #include "lib.h" 2 #include "windows.h" 3 #include "stdio.h"
阅读全文
摘要:1、VS2003新建DLL项目dllTest2、项目dllTest中添加脚本lib.h,代码如下:1 //lib.h2 #ifndef LIB_H3 #define LIB_H4 extern "C" int add(int x,int y);5 extern "C" int mius(int x,int y);6 #endif 3、项目dllTest中添加脚本lib.cpp,代码如下: 1 //lib.cpp 2 #include "lib.h" 3 int add(int x,int y) 4 { 5 return x + y;
阅读全文
摘要:1、VS2003新建DLL项目dllTest2、项目dllTest中添加脚本lib.h,代码如下:1 //lib.h2 #ifndef LIB_H3 #define LIB_H4 extern "C" int __declspec(dllexport) add(int x,int y);5 extern "C" int __declspec(dllexport) mius(int x,int y);6 #endif 3、项目dllTest中添加脚本lib.cpp,代码如下:1 #include "lib.h"2 int add(int
阅读全文
摘要:1、VS2003新建Static DLL项目libTest2、项目libTest中添加脚本lib.h,代码如下:1 //lib.h2 #ifndef LIB_H3 #define LIB_H4 extern "C" int add(int x,int y);5 extern "C" int mius(int x,int y);6 #endif3、项目libTest中添加脚本lib.cpp,代码如下: 1 //lib.cpp 2 #include "lib.h" 3 int add(int x,int y) 4 { 5 return x
阅读全文

浙公网安备 33010602011771号