Making it in C++ is fairly easy. Here it is:
typedef LPDIRECT3DDEVICE9 ( *GetDirect3DDevice ) ( void );
LPDIRECT3DDEVICE9 GetD3D9DevicePtr()
{
// Set the dll path & name
char path[_MAX_PATH];
strcpy(path, g_pGlob->pEXEUnpackDirectory);
strcat(path, "\\DBProSetupDebug.dll");
// Get Device pointer from the dll
HMODULE lib = LoadLibrary(path);
GetDirect3DDevice funcPtr = (GetDirect3DDevice) GetProcAddress(lib, "?GetDirect3DDevice@@YAPAUIDirect3DDevice9@@XZ");
LPDIRECT3DDEVICE9 d3dDevPtr = funcPtr();
FreeLibrary(lib);
return d3dDevPtr;
}
This is if you want to use the function inside the Dll, which is my case. If you want to export it to DBPro, do it as follows:
typedef int ( *GetDirect3DDevice ) ( void );
MYCOMMAND int GetD3D9DevicePtr()
{
// Set the dll path & name
char path[_MAX_PATH];
strcpy(path, g_pGlob->pEXEUnpackDirectory);
strcat(path, "\\DBProSetupDebug.dll");
// Get Device pointer from the dll
HMODULE lib = LoadLibrary(path);
GetDirect3DDevice funcPtr = (GetDirect3DDevice) GetProcAddress(lib, "?GetDirect3DDevice@@YAPAUIDirect3DDevice9@@XZ");
int d3dDevPtr = funcPtr();
FreeLibrary(lib);
return d3dDevPtr;
}
Thanks for your help guys.
== Jedive ==
AthlonXP 1600+, 512MB, GeForce4MX, WinXP/DX9, Fedora Core 3
iBook G4 1Ghz, 256MB, Radeon9200, Mac OS X Panther