|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VB2005 Short address pointerA call to a third party dll, which will call back, requires an hWnd and a 16
bit sub address. Yes this was designed for VB6. Addressof and delegates and all that good crap doesn't help. The hWnd where the subroutine is located is no problem. But how can I provide the subroutines address as a Short ?? GalenS >A call to a third party dll, which will call back, requires an hWnd and a 16 VB6 also targets Win32 so I don't see how it could work there.>bit sub address. Yes this was designed for VB6. >The hWnd where the subroutine is located is no problem. But how can I If you're running .NET 2.0 you can try calling>provide the subroutines address as a Short ?? Marshal.GetFunctionPointerForDelegate(), truncate the result to 16-bits and see if it works. Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
Show quote
Hide quote
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message My bad. In VB2005 it would be integer not shortnews:OPyyfPgbGHA.4892@TK2MSFTNGP02.phx.gbl... > >A call to a third party dll, which will call back, requires an hWnd and a > >16 >>bit sub address. Yes this was designed for VB6. > > VB6 also targets Win32 so I don't see how it could work there. > > >>The hWnd where the subroutine is located is no problem. But how can I >>provide the subroutines address as a Short ?? > > If you're running .NET 2.0 you can try calling > Marshal.GetFunctionPointerForDelegate(), truncate the result to > 16-bits and see if it works. > > > Mattias > > -- > Mattias Sjögren [C# MVP] mattias @ mvps.org > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com > Please reply only to the newsgroup. VB6 code in bas module. The Call SetEventTable is immediately followed by the 3rd party dll call WDU_Init Dim eventTable As WDU_EVENT_TABLE Call SetEventTable(eventTable, AddressOf DeviceAttach, AddressOf DeviceDetach) eventTable.pUserData = WD_VB_GetAddress(DevCtx, 1, 1) dwError = WDU_Init(hdriver, matchTable, 1, eventTable, _ DEFAULT_LICENSE_STRING, WD_ACKNOWLEDGE, hWnd) VB6 driver code bas module. It would appear that the AddressOf's could be left out of the SetEventTable call and placed directly after the ='s below. Public Sub SetEventTable(ByRef eventTable As WDU_EVENT_TABLE, ByVal attachCb As Long, _ ByVal detachCb As Long) eventTable.pfDeviceAttach = attachCb eventTable.pfDeviceDetach = detachCb End Sub Public Type WDU_EVENT_TABLE pfDeviceAttach As Long pfDeviceDetach As Long pfPowerChange As Long pUserData As Long End Type VB6 declares for callback procedures Public Function DeviceAttach(ByVal hDevice As Long, ByRef pDeviceInfo As WDU_DEVICE, _ ByRef pUserData As DEVICE_CONTEXT) As Boolean Public Sub DeviceDetach(ByVal hDevice As Long, ByRef pUserData As DEVICE_CONTEXT) GalenS
Substring question
vb.net, so slow !!!??? Support for multiple database General Question About Web Apps, VB/ASP? msmapi32.ocx Accessing existing Excel Workbook from complete path Application Error: CiceroUIWndFrame How to control Bluetooth? Screen Scraper that does Automated data entry. Debugging DLLs - best practice |
|||||||||||||||||||||||