I have created a VB DLL using the code given below. And then I tried to use that DLL in an VC++ Win32 application. Where the LoadLibrary/AfxLoadLibrary were working ok. But the GetProcAddress calls always returning NULL. Can anybody help?
VB Dll code:
Public Function LoadResourceInt eger(ByVal theStringID As Integer) As Integer
LoadResourceInt eger = 0
On Error GoTo ErrMsg
LoadResourceInt eger = 1000
Exit Function
ErrMsg:
LoadResourceInt eger = 0
MsgBox ("Resource:miss ing in MUI Resource File.") ' MUI - Multilanguage User Interface
End Function
VC++ Win32 App uses that VB DLL:
typedef int (__stdcall *LoadRessString )(int argument1);
HINSTANCE hMod;
hMod = AfxLoadLibrary( "MUIResourceEng lish.dll");
if(NULL == hMod)
{
MessageBox("Obj ect Not Created","Capti on",MB_OK);
return;
}
else
{
LoadRessString localLoadResStr ing;
localLoadResStr ing = (LoadRessString ) GetProcAddress( hMod,"LoadResou rceInteger");
if(localLoadRes String == NULL)
{
MessageBox("Get ProcAdress Failed","Captio n",MB_OK);
FreeLibrary( hMod);
return;
}
int myResString = localLoadResStr ing(1);
MessageBox("Suc cess","Caption" ,MB_OK);
return ;
}GetProcAddress (hMod,"LoadReso urceInteger");
if(localLoadRes String == NULL)
{
MessageBox("Get ProcAdress Failed","Captio n",MB_OK);
FreeLibrary( hMod);
return;
}
int myResString = localLoadResStr ing(1);
MessageBox("Suc cess","Caption" ,MB_OK);
return ;
}
Jothi Murugeswaran.S
VB Dll code:
Public Function LoadResourceInt eger(ByVal theStringID As Integer) As Integer
LoadResourceInt eger = 0
On Error GoTo ErrMsg
LoadResourceInt eger = 1000
Exit Function
ErrMsg:
LoadResourceInt eger = 0
MsgBox ("Resource:miss ing in MUI Resource File.") ' MUI - Multilanguage User Interface
End Function
VC++ Win32 App uses that VB DLL:
typedef int (__stdcall *LoadRessString )(int argument1);
HINSTANCE hMod;
hMod = AfxLoadLibrary( "MUIResourceEng lish.dll");
if(NULL == hMod)
{
MessageBox("Obj ect Not Created","Capti on",MB_OK);
return;
}
else
{
LoadRessString localLoadResStr ing;
localLoadResStr ing = (LoadRessString ) GetProcAddress( hMod,"LoadResou rceInteger");
if(localLoadRes String == NULL)
{
MessageBox("Get ProcAdress Failed","Captio n",MB_OK);
FreeLibrary( hMod);
return;
}
int myResString = localLoadResStr ing(1);
MessageBox("Suc cess","Caption" ,MB_OK);
return ;
}GetProcAddress (hMod,"LoadReso urceInteger");
if(localLoadRes String == NULL)
{
MessageBox("Get ProcAdress Failed","Captio n",MB_OK);
FreeLibrary( hMod);
return;
}
int myResString = localLoadResStr ing(1);
MessageBox("Suc cess","Caption" ,MB_OK);
return ;
}
Jothi Murugeswaran.S
Comment