Solved

Detect joystick force feedback effect in delphi using mmsystem.pas or others but not directx components or others

Posted on 2006-11-24
10
1,532 Views
Last Modified: 2012-08-14
How can I detect joystick force feedback effects using delphi7, I know the  mmsystem.pas functions and procedures  but i can not find any function that identify the effect that the joystick( Ex. tremble) is doing, I get the buttons, axis... how can I solve this problem without using external components like directx component or others?
Could somebody help me?

0
Comment
Question by:RuiGraca
  • 6
  • 3
10 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
AFAIK force feedback is only available through DirectX.
0
 

Author Comment

by:RuiGraca
Comment Utility
Yes I know but how can I access it? What do I need to use and witch functions that is my problem even using DelphiX DirectX component collection I can not get the joystick force feedback as I get the joystick axis and buttons that is my BIG Problem??
Please help me?
0
 

Author Comment

by:RuiGraca
Comment Utility
Is there somebody how can help me?
0
 

Author Comment

by:RuiGraca
Comment Utility
I am repeating the question sorry!!
0
 
LVL 9

Expert Comment

by:bernani
Comment Utility
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:RuiGraca
Comment Utility
Its the same question in other words I was getting desperate
0
 
LVL 9

Expert Comment

by:bernani
Comment Utility
Hi,

I understand.

I've never tried to program a joystick  . I'm not sure the links given  in your other thread will give you the solution. I believe, as written above by robert_marquardt that you'll need use DirectX.

You can eventually see at http://www.clootie.ru/delphi/download_dx92.html if you can't find sth newer to help you in this way.

If you don't plan to use external compos or directX, you'll probably need to write your own implementation.

Good luck.
0
 

Author Comment

by:RuiGraca
Comment Utility
Is digging in a pile of endless code to get a clue ...
Well I got to your link I even think the code  as
 DIEFFECT_DX5 = packed record
    dwSize: DWORD;                   (* sizeof(DIEFFECT_DX5) *)
    dwFlags: DWORD;                  (* DIEFF_*              *)
    dwDuration: DWORD;               (* Microseconds         *)
    dwSamplePeriod: DWORD;           (* Microseconds         *)
    dwGain: DWORD;
    dwTriggerButton: DWORD;          (* or DIEB_NOTRIGGER    *)
    dwTriggerRepeatInterval: DWORD;  (* Microseconds         *)
    cAxes: DWORD;                    (* Number of axes       *)
    rgdwAxes: PDWORD;                (* Array of axes        *)
    rglDirection: PLongint;          (* Array of directions  *)
    lpEnvelope: PDIEnvelope;         (* Optional             *)
    cbTypeSpecificParams: DWORD;     (* Size of params       *)
    lpvTypeSpecificParams: Pointer;  (* Pointer to params    *)
  end;


In Koders there are a C++ header that help somethink but getting a howto or something that explains is impossible I don´t get it.
0
 
LVL 9

Accepted Solution

by:
bernani earned 400 total points
Comment Utility
Hi,

See here for mor info at http://www.reactos.org/en/index.html
http://www.reactos.org/generated/doxygen/d2/d79/structDIEFFECT__DX5.html

and

http://www.shorthike.com/svn/trunk/libraries/dx80sdk/include/dinput.h

http://www.winehq.com/hypermail/wine-patches/2005/08/att-0123/01-ff-4-effect.diff
+/* This file contains all the Effect specific functions that can be used as stubs
+   by real force feedback effect implementations.
+
+   It also contains all the helper functions.



It's not in Delphi but maybe can help:

http://www.cygwin.com/ml/cygwin-patches/2004-q3/msg00120.html


+ * IDirectInputDevice8W interface
+ */
+#define INTERFACE IDirectInputDevice8W
+#define IDirectInputDevice8W_METHODS \
+    IDirectInputDevice7W_METHODS \
+    STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) PURE; \
+    STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) PURE; \
+    STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) PURE;
+DECLARE_INTERFACE_(IDirectInputDevice8W,IDirectInputDevice7W) { IDirectInputDevice8W_METHODS };
+#undef INTERFACE
+typedef struct IDirectInputDevice8W *LPDIRECTINPUTDEVICE8W;
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectInputDevice8_AddRef(p)             (p)->lpVtbl->AddRef(p)
+#define IDirectInputDevice8_Release(p)            (p)->lpVtbl->Release(p)
+/*** IDirectInputDevice methods ***/
+#define IDirectInputDevice8_GetCapabilities(p,a)       (p)->lpVtbl->GetCapabilities(p,a)
+#define IDirectInputDevice8_EnumObjects(p,a,b,c)       (p)->lpVtbl->EnumObjects(p,a,b,c)
+#define IDirectInputDevice8_GetProperty(p,a,b)         (p)->lpVtbl->GetProperty(p,a,b)
+#define IDirectInputDevice8_SetProperty(p,a,b)         (p)->lpVtbl->SetProperty(p,a,b)
+#define IDirectInputDevice8_Acquire(p)                 (p)->lpVtbl->Acquire(p)
+#define IDirectInputDevice8_Unacquire(p)               (p)->lpVtbl->Unacquire(p)
+#define IDirectInputDevice8_GetDeviceState(p,a,b)      (p)->lpVtbl->GetDeviceState(p,a,b)
+#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d)   (p)->lpVtbl->GetDeviceData(p,a,b,c,d)
+#define IDirectInputDevice8_SetDataFormat(p,a)         (p)->lpVtbl->SetDataFormat(p,a)
+#define IDirectInputDevice8_SetEventNotification(p,a)  (p)->lpVtbl->SetEventNotification(p,a)
+#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b)
+#define IDirectInputDevice8_GetObjectInfo(p,a,b,c)     (p)->lpVtbl->GetObjectInfo(p,a,b,c)
+#define IDirectInputDevice8_GetDeviceInfo(p,a)         (p)->lpVtbl->GetDeviceInfo(p,a)
+#define IDirectInputDevice8_RunControlPanel(p,a,b)     (p)->lpVtbl->RunControlPanel(p,a,b)
+#define IDirectInputDevice8_Initialize(p,a,b,c)        (p)->lpVtbl->Initialize(p,a,b,c)
+/*** IDirectInputDevice2 methods ***/
+#define IDirectInputDevice8_CreateEffect(p,a,b,c,d)           (p)->lpVtbl->CreateEffect(p,a,b,c,d)
+#define IDirectInputDevice8_EnumEffects(p,a,b,c)              (p)->lpVtbl->EnumEffects(p,a,b,c)
+#define IDirectInputDevice8_GetEffectInfo(p,a,b)              (p)->lpVtbl->GetEffectInfo(p,a,b)
+#define IDirectInputDevice8_GetForceFeedbackState(p,a)        (p)->lpVtbl->GetForceFeedbackState(p,a)
+#define IDirectInputDevice8_SendForceFeedbackCommand(p,a)     (p)->lpVtbl->SendForceFeedbackCommand(p,a)
+#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c)
+#define IDirectInputDevice8_Escape(p,a)                       (p)->lpVtbl->Escape(p,a)
+#define IDirectInputDevice8_Poll(p)                           (p)->lpVtbl->Poll(p)
+#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d)         (p)->lpVtbl->SendDeviceData(p,a,b,c,d)
+/*** IDirectInputDevice7 methods ***/
+#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d)
+#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d)
+/*** IDirectInputDevice8 methods ***/
+#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->lpVtbl->BuildActionMap(p,a,b,c)
+#define IDirectInputDevice8_SetActionMap(p,a,b,c)   (p)->lpVtbl->SetActionMap(p,a,b,c)
+#define IDirectInputDevice8_GetImageInfo(p,a)       (p)->lpVtbl->GetImageInfo(p,a)
+#endif
+
+DECL_WINELIB_TYPE_AW(LPDIRECTINPUTDEVICE8)
+DECL_WINELIB_TYPE_AW(IDirectInputDevice8)
+
+#endif /* DI8 */

0
 

Author Comment

by:RuiGraca
Comment Utility
I give you the point the question is not resoved but you are being a very cool guy in helping, i do not have words to show me gratfulness thanks the other i will leave open.

The Directinput9.pas uses mmsysstem I will try to pass the pointer to directinput and findout the struct that has the effects  I think I am close.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now