USB can only send bytes not words so divide your word into 2 bytes to send to the pc (Byte.HiByte & Byte.LowByte), on the PC side simply convert these 2 bytes back to a Long variable and everything should be fine.
I hope this helps.
USB can only send bytes not words so divide your word into 2 bytes to send to the pc (Byte.HiByte & Byte.LowByte), on the PC side simply convert these 2 bytes back to a Long variable and everything should be fine.
I hope this helps.
I wish I could say it did help
thank you though.
I set the test data to 1000 and 580 and sent it to the pc and i received 1000 and 580.
I think its the number from the ADC that is 8 bit.
thanks for any help
its working, but im still not sure why it wasnt working
what I did was:
variable.highbyte = adresh
variable.lowbyte = adresl
again. I dont know why, but I was only an 8 bit result from the adc.
Im glad its working and Ill move along, but does anyone know why my
adcin 0, variable
didnt work?
Other than that snag. my project went well.
I liked hidmaker. It took me alot longer than the hour or whatever Dr. Bob says it should take, but most of my time was deciding which descriptors to use.
Glad you got it working Scorpion, it is not too bad when you have all the elements in place.
Regards
Sean.
I am using easyHID sofware to generate a Visual basic code 6.0. I have the visual basic .net installed. So when i copy the file from vb.6 to vb.net , Vb.net upgrades the file to the .net configuration.Except for one thing that gave me an error:it's the upgrade warning about adding a delegate.
Public Function ConnectToHID(ByVal pHostWin As Integer) As Boolean
FWinHandle = pHostWin
ConnectToHID = hidConnect(FWinHandle)
'UPGRADE_WARNING: Add a delegate for AddressOf WinProc Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1048"'
FPrevWinProc = SetWindowLong(FWinHandle, GWL_WNDPROC, AddressOf WinProc)
End Function
I couldn't figure out how to fix it, Any idea?? here is what the help menu suggested :
In Visual Basic 6.0, the AddressOf operator was used to pass the address in memory of a function to an API procedure that takes a function pointer as an argument.
In Visual Basic .NET, the AddressOf operator must be used with a Delegate type. Delegates allow Visual Basic .NET to maintain a pointer to a function even if the function itself has already been garbage-collected.
The following example illustrates how a callback function that uses AddressOf is upgraded:
' Visual Basic 6.0
Declare Function SetWindowLong Lib "USER32.DLL" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal attr As Long, ByVal lVal As Long) As Long
Sub SubClassWindow(ByVal hwnd As Long)
If PrevProcPtr = 0 Then
PrevProcPtr = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf SubClassProc)
End If
End Sub
' After upgrade to Visual Basic .NET
Declare Function SetWindowLong Lib "USER32.DLL" Alias "SetWindowLongA"(ByVal hwnd As Integer, ByVal attr As Integer, ByVal lVal As Integer) As Integer
Sub SubClassWindow(ByVal hwnd As Integer)
If PrevProcPtr = 0 Then
' UPGRADE_WARNING: Add a delegate for AddressOf SubClassProc.
PrevProcPtr = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf SubClassProc)
End If
End Sub
What to do next
Add a delegate for the AddressOf operator, and change the parameter of the function declaration to the Delegate type:
Delegate Function SubClassProcDelegate(ByVal hwnd As Integer, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Declare Function SetWindowLong Lib "USER32.DLL" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal attr As Integer, ByVal lVal As SubClassProcDelegate) As Integer
Sub SubClassWindow(ByVal hwnd As Integer)
If PrevProcPtr = 0 Then
PrevProcPtr = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf SubClassProc)
End If
End Sub
Thank you in advance
Last edited by rocky79; - 3rd March 2006 at 07:24.
Sorry for the about 1 year later reply but anyways, this will be handy for new VBExpress 2005 user... probably .NET ones too.
Today, while trying to port USBDemo From VB6 to VBExpress, i came across the same issue. The simple fix is to add those 2 lines bellow in the mcHIDInterface.vb module, right under all Declare statement
HTHCode:' ' adding delegate to suite VBExpress 2005 requirement ' =================================================== Delegate Function SubClassProcDelegate(ByVal hwnd As Integer, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer Declare Function SetWindowLong Lib "USER32.DLL" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal attr As Integer, ByVal lVal As SubClassProcDelegate) As Integer
Last edited by mister_e; - 27th May 2007 at 22:07.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
.netNo way for me! I will be using .com (VB5 & 6) for life. There will always be backwards compatibility for .com, no matter what. Out of interest, even the latest versions of MS Office still use .com Microsoft will never completely abandon .com, willing to bet my life on it.
Bookmarks