VB.net USB HID Program

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
gramo
Registered User
Registered User
Posts: 200
Joined: Tue Mar 20, 2007 6:55 am
Location: Australia
Contact:

VB.net USB HID Program

Post by gramo » Sun Nov 08, 2009 2:23 am

I made a program that uses the mcHID.dll library (similar to the VB5 code produced by SF), though it works with VB.net (framework 4, can be rolled back if need be)

Image

As it stands now, iHID is a USB HID report manager. Allows you to connect to the desired device and view incoming reports, state changes and send reports.

Downloads can be found on this page
Last edited by gramo on Sun Nov 08, 2009 9:57 am, edited 1 time in total.
digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.

Australian distributor for the Swordfish Compiler

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Sun Nov 08, 2009 9:04 am

That's a great contribution - thanks. I've registered on your site to download it, but the link to download the source code is not working for me. The mcHID download works OK, but not the source code.

gramo
Registered User
Registered User
Posts: 200
Joined: Tue Mar 20, 2007 6:55 am
Location: Australia
Contact:

Post by gramo » Sun Nov 08, 2009 9:19 am

Not sure what happened there Steve, I've updated the file just in case.

Is it accessible now?
digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.

Australian distributor for the Swordfish Compiler

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Sun Nov 08, 2009 9:31 am

That's great thanks Graham, it's downloaded OK now. Thanks for sorting it out so fast.

gramo
Registered User
Registered User
Posts: 200
Joined: Tue Mar 20, 2007 6:55 am
Location: Australia
Contact:

Post by gramo » Sun Nov 08, 2009 11:03 am

Updated the source code with a few more comments should you find your self wondering what's going on
digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.

Australian distributor for the Swordfish Compiler

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Sun Nov 08, 2009 12:18 pm

Thanks for doing that.

hniekus
Posts: 4
Joined: Sun May 11, 2014 7:10 am

Re: VB.net USB HID Program

Post by hniekus » Sat Sep 20, 2014 1:08 pm

I made a program based on this. It worked fine in Windows 7 and 8.
After the update to windows 8.1 the mcHID.dll does not work anymore.
Does somebody have a solution?

Thanks

Hans Niekus

bitfogav
Registered User
Registered User
Posts: 169
Joined: Sat Oct 09, 2010 1:39 pm
Location: United Kingdom

Re: VB.net USB HID Program

Post by bitfogav » Sat Sep 20, 2014 8:07 pm

Is the version of windows 8.1 32bit or 64bit? I know that mcHID.dll only supports 32bit..

hniekus
Posts: 4
Joined: Sun May 11, 2014 7:10 am

Re: VB.net USB HID Program

Post by hniekus » Sun Sep 21, 2014 6:48 am

Thanks for your replay

I do use a 32 version. It stopt after the upgrade from 8.0 to 8.1.

I do not get a message it just hangs. So it gets lost in unmanaged code (dll).
Simple tasks that only need the mcHID.dll, such as register the USB device and asking the serial number, work. When the user32.dll get involved, than it does not work.
I did see that the user32.dll (also used here) is much larger than in Windows 8.

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: VB.net USB HID Program

Post by Coccoliso » Sun Sep 21, 2014 10:53 am

You did not specify if the NET compiled program is in x64 or x86 mode.
In Visual Studio you can set whether to generate an assembly for the x86 or x64 .. if the DLL can only work in x86 then you have to compile the VB program in x86 mode.
A 32 bit system work correctly and when use it on a windows x64 it will run under WOW64 and everything should work without problems. In VS2010 to set the correct x86/x64 generation of the program you have to go into the property of the project and in the Compilation tab at the top select the x86 platform.

hniekus
Posts: 4
Joined: Sun May 11, 2014 7:10 am

Re: VB.net USB HID Program

Post by hniekus » Sun Sep 21, 2014 1:26 pm

Everything worked fine until the 8.1 update came via the windows update a year ago.
After that I switched from 2010 to Visual basic express 2013. I also did set the x86.
Nothing helped.
I do use the 32 bit version of windows.
The problem is in the mcHID.dll. That cannot communicate with the new user.dll of windows 8.1 ?
As I mentioned before : Simple tasks that only need the mcHID.dll, such as register the USB device and asking the serial number, work. When the user32.dll get involved, than it does not work.
I do not know how to repair that. I did not write that. Is there a newer version?
Or am I the only one that is having problems with windows 8.1 ???

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: VB.net USB HID Program

Post by Coccoliso » Sun Sep 21, 2014 3:57 pm

Probably MS has changed the management of USB at level permissions, since it is the USER.DLL to manage it.
I saw on the net that you're not the only one having this problem with USB and this DLL in W8.1 and does not seem to have found the solution.
The only thing that comes to mind is to try to run the program as administrator in compatibility mode with a lower system type like W7 or XP ( if in W8.1 still exists the possibility ).
I'm sorry I have not upgraded to 8.1 because already in version 8.0 I had found very inconvenient to use the mouse and do not have a touchscreen.

hniekus
Posts: 4
Joined: Sun May 11, 2014 7:10 am

Re: VB.net USB HID Program

Post by hniekus » Mon Sep 22, 2014 4:30 pm

As administrator and compatibility mode, I tried them without success.
Next year Windows 9 is coming. Windows 7 is support is stopping in 2020. That looks far away.
I wold be nice that the mcHID.dll will also work on the newer versions of Windows (8.1 and up).
The source of that DLL is available. I hoped someone could look into that?
The original link does not work, I do have a copy :
http://www.sysanalyser.com/dl/iHID_VB2008.zip
It is a great DLL.

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: VB.net USB HID Program

Post by Coccoliso » Mon Sep 22, 2014 10:46 pm

Hello,
I looked at the source you posted and I saw that in the wrapper of mcHID.dll (which do not have the source code, at least in the zip) refers to the functions CallWindowProc, SetWindowLong and DelegateSetWindowLong who are in the infamous User32.dll
I think we should refer to the call of these 3 functions occurring in MSDN for W8.1 if something has changed.

Post Reply