Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

Joystick API

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jack Russell - 04 Oct 2007 09:06 GMT
Can anyone give me an example of using joygetdevcaps and joygetposex in
vb.net. I have no problem in VB6 but get various exceptions, memory
violations in .net. I have (I think converted all the longs to integers
etc)

Thanks

Jack Russell
rowe_newsgroups - 04 Oct 2007 11:37 GMT
> Can anyone give me an example of using joygetdevcaps and joygetposex in
> vb.net. I have no problem in VB6 but get various exceptions, memory
[quoted text clipped - 4 lines]
>
> Jack Russell

Wow, surprisingly nothing show up for either function on pinvoke.net.
Perhaps you could post the API's so we could take a look at the
original, and your new declarations.

Thanks,

Seth Rowe
Jack Russell - 08 Oct 2007 01:26 GMT
>>Can anyone give me an example of using joygetdevcaps and joygetposex in
>>vb.net. I have no problem in VB6 but get various exceptions, memory
[quoted text clipped - 12 lines]
>
> Seth Rowe

Still struggling although have found I can make it work (VB6 needs the
structures passed by val, .net by ref).

However I need the following structure

Private Type JOYCAPS
   wMid As Integer
   wPid As Integer
   szPname As String *32
   wXmin As Long
   wXmax As Long
   wYmin As Long
   wYmax As Long
   wZmin As Long
   wZmax As Long
   wNumButtons As Long
   wPeriodMin As Long
   wPeriodMax As Long
End Type

How do I do the string in .net (I know to change the type to a
structure). The only way I have found is to pad it with integers
although strangely not to the length that I would have expected!
Armin Zingler - 08 Oct 2007 01:39 GMT
> rowe_newsgroups wrote:
> > On Oct 4, 4:06 am, Jack Russell <ja...@norubbish.tpg.com.au>
[quoted text clipped - 19 lines]
> Still struggling although have found I can make it work (VB6 needs
> the structures passed by val, .net by ref).

The API function needs them "ByRef", in VB6 as well as in VB.Net. If you
don't specify anything in VB6, it defaults to ByRef.

> However I need the following structure
>
[quoted text clipped - 16 lines]
> structure). The only way I have found is to pad it with integers
> although strangely not to the length that I would have expected!

What's your current VB.Net declaration?

Armin
Jack Russell - 08 Oct 2007 10:07 GMT
>> > On Oct 4, 4:06 am, Jack Russell <ja...@norubbish.tpg.com.au>
>> > wrote:
[quoted text clipped - 21 lines]
> The API function needs them "ByRef", in VB6 as well as in VB.Net. If you
> don't specify anything in VB6, it defaults to ByRef.

I agree with you, it is just that the sample program I found on the net
had them byval and it worked in VB^. Maybe VB6 is cleverer than we thought!
>> However I need the following structure
>>
[quoted text clipped - 20 lines]
>
> Armin
I got it to work after finding this in a sample program (unfortunately I
cannot get Help to tell me what it means).

    <StructLayout(LayoutKind.Sequential)> _
  Private Structure JOYCAPS
        Dim wMid As Int16
        Dim wPid As Int16
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
        Dim szPname As String ' * MAXPNAMELEN
        Dim wXmin As Integer
        Dim wXmax As Integer
        Dim wYmin As Integer
        Dim wYmax As Integer
        Dim wZmin As Integer
        Dim wZmax As Integer
        Dim wNumButtons As Integer
        Dim wPeriodMin As Integer
        Dim wPeriodMax As Integer
    End Structure
Spam Catcher - 04 Oct 2007 19:51 GMT
Jack Russell <jackr@norubbish.tpg.com.au> wrote in news:O4HMq1lBIHA.3848
@TK2MSFTNGP05.phx.gbl:

> Can anyone give me an example of using joygetdevcaps and joygetposex in
> vb.net. I have no problem in VB6 but get various exceptions, memory
> violations in .net. I have (I think converted all the longs to integers
> etc)

Have you taken a look at managed direct x? You could try using DirectInput?
Jack Russell - 04 Oct 2007 21:19 GMT
> Jack Russell <jackr@norubbish.tpg.com.au> wrote in news:O4HMq1lBIHA.3848
> @TK2MSFTNGP05.phx.gbl:
[quoted text clipped - 5 lines]
>
> Have you taken a look at managed direct x? You could try using DirectInput?
I am using Express versions which I understand do not support Direct X

Jack Russell
Spam Catcher - 04 Oct 2007 21:51 GMT
Jack Russell <jackr@norubbish.tpg.com.au> wrote in news:OHsBZPsBIHA.912
@TK2MSFTNGP05.phx.gbl:

> I am using Express versions which I understand do not support Direct X

DirectX is an additional download. The Managed SDK is inside the SDK along
with associated documentation and samples.
Jack Russell - 05 Oct 2007 01:00 GMT
> Jack Russell <jackr@norubbish.tpg.com.au> wrote in news:OHsBZPsBIHA.912
> @TK2MSFTNGP05.phx.gbl:
[quoted text clipped - 3 lines]
> DirectX is an additional download. The Managed SDK is inside the SDK along
> with associated documentation and samples.
Thanks, I will take a look

Jack

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.