D
drinven
Unregistered / Unconfirmed
GUEST, unregistred user!
以下是我用c++ builder编的dll程序,生成dll文件后,在VB中调用这个dll函数(test函数)发现总是
hrs==NULL,不知道是何原因
请高手们指教,小的不胜感激
//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#pragma resource "test.res"
//---------------------------------------------------------------------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) BSTR __stdcall test(const char* c);
//---------------------------------------------------------------------------
__declspec(dllexport) BSTR __stdcall test(const char* c)
{
BSTR bstr;
HRSRC hrs;
HMODULE ghmodule=GetModuleHandle(NULL);
hrs=FindResource(ghmodule,"GBK2BIG",RT_RCDATA);
if (hrs==NULL)
{
ShowMessage("findresource error");
}
return bstr;
}
hrs==NULL,不知道是何原因
请高手们指教,小的不胜感激
//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#pragma resource "test.res"
//---------------------------------------------------------------------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) BSTR __stdcall test(const char* c);
//---------------------------------------------------------------------------
__declspec(dllexport) BSTR __stdcall test(const char* c)
{
BSTR bstr;
HRSRC hrs;
HMODULE ghmodule=GetModuleHandle(NULL);
hrs=FindResource(ghmodule,"GBK2BIG",RT_RCDATA);
if (hrs==NULL)
{
ShowMessage("findresource error");
}
return bstr;
}