DirectX Issues

EliteELMO

Newcomer
Joined
Aug 3, 2005
Messages
6
I managed to install the DirectX SDK onto my computer, but everytime I use the code Imports it won't let me import any sort of DirectX libs into my application.

How do I use DX? I found a tutorial on using DirectInput ( I need to implement it into my application) and it says to use

Code:
Imports Sunlight.DirectX.Graphics
Imports Sunlight.DirectX.Input
Imports Sunlight.DirectX.SoundMusic

The odd thing is, it tells me that Sunlight is undefined. How do I get the DirectX SDK to be recognized by VB.NET? Did I install the wrong version of it, or something?
 
In the Solution Explorer tab over on the right-hand side of the window, click on your project, then expand the References tab. Right-click on References, wait, and then double-click all of the necessary DirectX References that you want to use. :)
 
Thank you SO MUCH. I really apprciate it. You guys are always so helpful... This is one of my favorite places now, haha. ;)
 
Sorry for the double post, but I have yet another question, and didn't want to create a new thread to ask it.

Is there someone who can tell me how to convert a string (a letter, ie "k") to the integer that DirectInput uses?


I tried using SKey = CapChar, which returns the following error:

Code:
See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidCastException: Cast from string "k" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format.
   at Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat)
   at Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value)
   at Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
   --- End of inner exception stack trace ---
   at Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
   at Halo_Screencap.frmMain.DIWatch_Tick(Object sender, EventArgs e) in C:\Documents and Settings\The 4Life Network\My Documents\Visual Studio Projects\Halo Screencap\frmMain.vb:line 771
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
HSC
    Assembly Version: 1.0.2051.21692
    Win32 Version: 1.0.2051.21692
    CodeBase: file:///C:/Documents%20and%20Settings/The%204Life%20Network/My%20Documents/Visual%20Studio%20Projects/Halo%20Screencap/bin/HSC.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 7.0.5000.0
    Win32 Version: 7.10.3052.4
    CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
Microsoft.DirectX.DirectInput
    Assembly Version: 1.0.2902.0
    Win32 Version: 5.04.00.2904
    CodeBase: file:///c:/windows/assembly/gac/microsoft.directx.directinput/1.0.2902.0__31bf3856ad364e35/microsoft.directx.directinput.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
All of the Directinput.Key integers are ridiculously long, and short of coding a conversion of one letter to the ridiculous integer by hand, is there a shorter way of doing this, like a built-in converter in DirectX or an application that can do this for me?

EDIT: I'm a TOTAL DirectX newbie, and I just need to tap into directX enough to set up the detection of keypresses so I can take a screenshot immediately after the input is sent. I'm just having so many issues with this!
 
Last edited:
To convert a string to the integer of the character, you can examine the first character of the string.

s.Chars(0)

and then Convert.ToInt32()

Num = Convert.ToInt32(s.Chars(0))
:)
 
Back
Top