comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Calling DirectInput from IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Calling DirectInput from IDL [message #38116] Tue, 17 February 2004 15:04
bbhyun2001 is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to make higher resolution GIF or JPEG image?
Next Topic: changing axis scale

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:48:48 PDT 2025

Total time taken to generate the page: 0.00433 seconds