15,471
社区成员
发帖
与我相关
我的任务
分享
DWORD_PTR CreateInterface(DWORD dwParam)
{
DWORD_PTR dwInterface = 0;
switch (dwParam)
{
//
// 根据你的需要传出函数地址或者对象地址
}
return dwInterface; // 既然是你自己设计的插件,这个dwInterface是什么都无所谓,你自己定义;但是要注意一点:这个函数最好可扩展,并且通用,并且长时间使用不做修改
}
// Name.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
CHAR Name[50] = {0};
PCHAR GetName(void)
{
return Name;
}
extern "C" __declspec(dllexport) BOOL WINAPI SetName(PCHAR NewName)
{
PCHAR OldName = GetName();
if (strcmp (OldName, NewName) == 0) // invalid name
{
return FALSE;
}
else if (strlen (NewName) >= 256) // invalid len
{
return FALSE;
}
strcpy (Name, NewName); // set name
return TRUE;
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
OutputDebugString("NameDll: dll attach");
SetName("aaaa");
}
}
return TRUE;
}