Calling DirectInput from IDL [message #38116] |
Tue, 17 February 2004 15:04 |
bbhyun2001
Messages: 5 Registered: January 2004
|
Junior Member |
|
|
Hi,all
I need to call direct input(force feedback) functionality from IDL for
my application. I played with DLM little bit and I decide to call
joystick functionality from IDL for practice first. I know that this
will be a long way with my poor DLM experience to get the result I
want. Anyway,I wrote the simple following code: getting direct input
ID from IDL and returning it back to DLM for destroying direct input.
But I have a compiling error as I run the file. How can I solve this
problem? Am I in the right track? Any advice will be greatly
appreciated.
#define STRICT
#define DIRECTINPUT_VERSION 0x0800
;
;
;
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
LPDIRECTINPUT8 g_pDI = NULL;
;
;
;
extern IDL_VPTR IDL_CDECL diTestBedINI_HC(int argc,IDL_VPTR
argv[],char* argk)
{
// called in IDL: pbDirectInputID = diTestBedINI_HC();
HRESULT hr;
if( FAILED( hr = DirectInput8Create( GetModuleHandle(NULL),
DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&g_pDI, NULL ) ) )
IDL_Message(IDL_M_NAMED_GENERIC,IDL_MSG_LONGJMP," Fail to get the DI
Instance");
UCHAR *store;
IDL_VPTR new_array;
IDL_LONG dims[1];
dims[0] = sizeof(g_pDI);
store = (UCHAR *)malloc(dims[0]);
memcpy(store,&g_pDI,dims[0]);
new_array = IDL_ImportArray(1,dims,IDL_TYP_BYTE,store,NULL,NULL);
return new_array;
}
void IDL_CDECL diTestBedDestroy_HC(int argc,IDL_VPTR argv[],char*
argk)
{
// called in IDL: diTestBedDestroy_HC,pbDirectInputID;
char *pDIID;//??
IDL_ENSURE_ARRAY(argv[0]);
pDIID = (char*)argv[0]->value.arr->data;//??
SAFE_RELEASE(pDIID);//??
}
//error C2227: left of '->Release' must point to class/struct/union
--BB
|
|
|