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

Home » Public Forums » archive » Re: 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
Re: Calling DirectInput from IDL [message #38079] Thu, 19 February 2004 11:19
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"Andrew Cool" wrote ...
> (IDLUser) wrote...
>> 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.
>
> Go talk with God, aka Rick Towler, who has done all this
> for you already.

<Dr. Nick Riviera> Stop! You're embarrassing me!</Dr. Nick>

I think my salary doesn't justifies that title. Plus, I don't know if I
want to be associated with such a saintly moniker. The members of the IDL
EPA seem like quite a raucous bunch and I would like them to think that I
could fit right in.

:)

-Rick
Re: Calling DirectInput from IDL [message #38088 is a reply to message #38079] Wed, 18 February 2004 22:17 Go to previous message
bbhyun2001 is currently offline  bbhyun2001
Messages: 5
Registered: January 2004
Junior Member
andrew.cool@dsto.defence.gov.au (Andrew Cool) wrote in message news:<c6d70400.0402181525.3658fed@posting.google.com>...
> bbhyun2001@yahoo.com (IDLUser) wrote in message news:<a1d082bc.0402171504.5d0197df@posting.google.com>...

Wow! Everything is changed in a day. Thanks Karl and Andrew for
responding to my mail and special thanks for my God,Rick Towler, for
letting us see his efforted source code :) Thanks you all again.

--BB
>> 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.
>
> Go talk with God, aka Rick Towler, who has done all this
> for you already.
>
> Andrew
Re: Calling DirectInput from IDL [message #38095 is a reply to message #38088] Wed, 18 February 2004 16:15 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"IDLUser" wrote...

> 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.

I have written a direct input DLM that you may want to look at. You could
easily fold force feedback effects into it and you would get the keyboard
and mouse for free.

Compiled dlm and example program and docs are available here:

http://www.acoustics.washington.edu/~towler/directInputDLM.h tml

Source is here:

http://www.acoustics.washington.edu/~towler/programs/directI nputSource.zip

-Rick
Re: Calling DirectInput from IDL [message #38097 is a reply to message #38095] Wed, 18 February 2004 15:25 Go to previous message
andrew.cool is currently offline  andrew.cool
Messages: 47
Registered: July 2003
Member
bbhyun2001@yahoo.com (IDLUser) wrote in message news:<a1d082bc.0402171504.5d0197df@posting.google.com>...
> 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.

Go talk with God, aka Rick Towler, who has done all this
for you already.

Andrew
Re: Calling DirectInput from IDL [message #38101 is a reply to message #38097] Wed, 18 February 2004 09:25 Go to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
You might consider using the ul (ULONG) member in IDL_ALLTYPES to pass the
DD handle around. Also, ptrint may be a better choice if you have 6.0.

You would need to cast the handle to a LPDIRECTINPUT8 in the Destroy
routine, and in any others that need the handle.

So you might want to try something like:

In create:

IDL_VPTR vpHandle;
vpHandle = IDL_GettmpULong((IDL_ULONG)g_pDI);
return vpHandle;

In destroy:
LPDIRECTINPUT8 pDIID;
pDIID = (LPDIRECTINPUT8) argv[0]->value.ul;

Code untested, but may give you an idea.

Karl

"IDLUser" <bbhyun2001@yahoo.com> wrote in message
news:a1d082bc.0402171504.5d0197df@posting.google.com...
> 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: Website update
Next Topic: lmhostid Problem (network card as dongle)

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

Current Time: Wed Oct 08 14:56:13 PDT 2025

Total time taken to generate the page: 0.01104 seconds