-1

I have a program which uses an API from dinput.dll (Direct Input), I have monitored it and the result is this:

API Name: DirectInputCreateEx Module Name: C:\Windows\system32\DINPUT.dll

And about another program which uses Direct Input:

API Name: DirectInputCreateA Module Name: C:\Windows\system32\DINPUT.dll

This API will update this registry key:

HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\DirectInput

I want to know How can I use Delphi to write a code which ONLY call this API for DirectInput dll?

Any Help is really appreciated...

Inside Man
  • 4,194
  • 12
  • 59
  • 119

1 Answers1

1

In order to call Direct Input you will need a Delphi translation of the header file. The best such translation, to my knowledge, is available from the Clootie graphics pages.

You need to use the DirectInput.pas header translation.

As for writing a program that does not show a Window, here's the simplest template:

program MyProgram;
begin
  //write your program's code here
end.

You state in a comment that the only function you wish to call is DirectInputCreateEx. To call that function you need the following import declaration:

function DirectInputCreateEx(hinst: THandle; dwVersion: DWORD; 
  const riidltf: TGUID; out ppvOut; punkOuter: IUnknown): HResult; 
  stdcall; external 'dinput.dll';
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Needs a period instead of a semicolon – Mike W Jan 11 '12 at 16:29
  • 2
    Sorry, I can't do that. How would I even know what you write? You didn't say what you wanted to do. Make a start yourself and ask for help when you get stuck. – David Heffernan Jan 11 '12 at 17:31
  • Ok, Your answer can help me a lot man :) I have change my question a little :) – Inside Man Jan 11 '12 at 17:53
  • Your question is getting less clear to me. I answered how to call DirectInput from Delphi, but now you are talking about registry? I'm very confused. – David Heffernan Jan 11 '12 at 18:19
  • Hi David, I just want to use only DirectInputCreateEx API from dinput.dll, I do not want to use any other APIs, I think Direct Input header file has too many extra API. I just one to use one, without using nay extra info and any extra direct x API. How to do that? – Inside Man Jan 12 '12 at 17:03
  • OK, I answered that but I find it hard to imagine that's all you need to call. What is your actual problem? – David Heffernan Jan 12 '12 at 23:19
  • Hi David, Really I just want to update that registry key, why? Because I want to get the list of connected joysticks with their IDs. ePSXe (PS1 Emu) will use the API which I have witten in main question. So the registry will update and I can see the connected joysticks. Just this. So Can you help me again David? – Inside Man Jan 13 '12 at 05:08
  • Another Thing David, if you delete that reg key, and execute this API, it will be created again, no joystick is needed for testing. But I do not know how to make it :( – Inside Man Jan 13 '12 at 06:08
  • I don't think this question can be salvaged easily. You are now asking completely different questions in comments. You need to ask a new question. However please do not ask it as you have done here. Don't present your proposed solution. Present the underlying problem and ask for a solution. – David Heffernan Jan 13 '12 at 07:20