日期:2014-05-17 浏览次数:20706 次
class C_strOpDll
{
[DllImport("CXstr.dll")]
public static extern void myTest();
}
public Form1()
{
InitializeComponent();
MessageBox.Show("00");
C_strOpDll.myTest();
MessageBox.Show("11");//这里换XP系统运行不到这里,win8能到这里
}
extern "C" __declspec(dllexport) void myTest()
{
MessageBox(NULL,TEXT("OK"),TEXT("test ij"),MB_OK);//XP没有到这步
}
//另外我在DLL入口函数内也加了MSGBOX
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
MessageBox(NULL,TEXT("123"),TEXT("123"),MB_OK); //XP也没到这里
break;
}
return TRUE;
}