/********** Dll 动态链接库的创建与调用教程示例 ********************/
/*Dll动态链接库模块的创建和编写过程:首先是建立Win32控制台应用程序,然后选择创建Dll模块,
创建成功后,在头文件的文件夹中新建一个Test_dll.h ,接下来在源文件文件夹中新建一个
Test_Example.cpp资源文件,完成相关代码后,生成解决方案(即生成dll文件和lib文件),
然后把这两个文件拷贝到TestExample工程的debug(即调试时生成.EXE的文件目录下),
然后回到编译器中的TestExample工程,编译即可成功调用刚才所建的Test_dll.dll动态链接库
/*******************************************************************************/
//编写:无限 QQ:617552809 希望能帮助更多像我一样的初学者
/********************************************************************************/
#include "Test_dll.h"
#include"windows.h"
#include"stdio.h"
// a sample exported function
int DLL_EXPORT Max(int a,int b)
{
return a>b?a:b;
}
int DLL_EXPORT StaticFuc()
{
static int d=20;
return d++;
}
void HelloWorld()
{
MessageBox(NULL,TEXT("你好,你已成功!"),TEXT("恭喜:"),MB_OK);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
//MessageBox(NULL,TEXT("DLL模块已成功加载!"),TEXT("提醒:"),MB_OK);
printf("dll模块已被加载!");
break;
case DLL_PROCESS_DETACH:
// detach from process
printf("dll模块已被卸载完毕!");
break;
case DLL_THREAD_ATTACH:
// attach to thread
printf("新的线程已被创建!");
break;
case DLL_THREAD_DETACH:
// detach from thread
printf("新的线程已被销毁!");
break;
}
return TRUE; // succesful}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Win32 Dll工程创建与调用示例.rar (85个子文件)
Win32 Dll工程创建与调用示例
TestExample
TestExample
Debug
cl.command.1.tlog 794B
link.6932-cvtres.write.1.tlog 2B
rc.command.1.tlog 680B
CL.read.1.tlog 13KB
vc100.idb 379KB
mt.read.1.tlog 550B
link-cvtres.read.1.tlog 2B
link.read.1.tlog 3KB
link.6932.write.1.tlog 2B
rc.read.1.tlog 522B
link.write.1.tlog 1KB
TestExample_manifest.rc 212B
CL.write.1.tlog 536B
TestExample.lastbuildstate 96B
vc100.pdb 108KB
TestExample.exe.intermediate.manifest 381B
link.6932-cvtres.read.1.tlog 2B
link.command.1.tlog 2KB
Test_Example.obj 25KB
mt.write.1.tlog 446B
TestExample.exe.embed.manifest 406B
mt.command.1.tlog 464B
TestExample.exe.embed.manifest.res 472B
rc.write.1.tlog 426B
link-cvtres.write.1.tlog 2B
TestExample.log 2KB
link.6932.read.1.tlog 2B
TestExample.vcxproj.user 143B
TestExample.vcxproj.filters 950B
TestExample.vcxproj 4KB
Test_Example.cpp 1KB
Debug
TestExample.pdb 483KB
Test_dll.dll 28KB
TestExample.ilk 295KB
Test_dll.lib 2KB
TestExample.exe 28KB
ipch
testexample-fb72054c
testexample-520c0258.ipch 31.25MB
TestExample.sln 900B
TestExample.suo 9KB
TestExample.opensdf 56B
TestExample.sdf 24.71MB
Test_dll
Debug
Test_dll.dll 28KB
Test_dll.pdb 379KB
Test_dll.exp 890B
Test_dll.ilk 264KB
Test_dll.lib 2KB
ipch
test_dll-3a3278b9
test_dll-c06c53e7.ipch 31.25MB
Test_dll.opensdf 56B
Test_dll.suo 9KB
Test_dll
Debug
cl.command.1.tlog 838B
link.8300-cvtres.write.1.tlog 2B
link.8300.read.1.tlog 2B
rc.command.1.tlog 626B
CL.read.1.tlog 13KB
vc100.idb 363KB
mt.read.1.tlog 514B
Test_dll.dll.embed.manifest 406B
link-cvtres.read.1.tlog 2B
link.read.1.tlog 4KB
Test_dll.obj 26KB
Test_dll.lastbuildstate 93B
rc.read.1.tlog 486B
link.8300-cvtres.read.1.tlog 2B
link.write.1.tlog 1KB
CL.write.1.tlog 484B
Test_dll_manifest.rc 208B
vc100.pdb 100KB
link.command.1.tlog 2KB
link.8300.write.1.tlog 2B
Test_dll.log 4KB
Test_dll.write.1.tlog 438B
Test_dll.dll.intermediate.manifest 381B
Test_dll.dll.embed.manifest.res 472B
mt.write.1.tlog 410B
mt.command.1.tlog 434B
Test_dll.Build.CppClean.log 3KB
rc.write.1.tlog 390B
link-cvtres.write.1.tlog 2B
Test_dll.vcxproj.filters 1KB
Test_dll.vcxproj 4KB
Test_dll.cpp 2KB
Test_dll.h 966B
Test_dll.vcxproj.user 143B
Test_dll.sdf 23.64MB
Test_dll.sln 891B
共 85 条
- 1
资源评论
- iBabyFace2013-10-11很好的资料,适合初学者
千崖秋色
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功