Use a C++ DLL
Re: Use a C++ DLL
Hi Polo,
Thanks for all your great work.
I have wanted to know how to make a wrapper, too.
There is a PB wrapper for freeimage dll 32bit which might give you a start. I can send it to you if you wish. As your coding ability transcends mine you might be able glean something from it.
Since that PB wrapper is available, one of our friends on this forum must know how its done!
Also there are a few threads on freeimage wrapper. Luis might be able to assist you, perhaps.
Regards,
Dave
Thanks for all your great work.
I have wanted to know how to make a wrapper, too.
There is a PB wrapper for freeimage dll 32bit which might give you a start. I can send it to you if you wish. As your coding ability transcends mine you might be able glean something from it.
Since that PB wrapper is available, one of our friends on this forum must know how its done!
Also there are a few threads on freeimage wrapper. Luis might be able to assist you, perhaps.
Regards,
Dave
DE AA EB
Re: Use a C++ DLL
Hey Dave,
I think the freeimage lib export C functions?
Unfortunately I'm only able to code with Purebasic, the rest is just too complicated for me
I think the freeimage lib export C functions?
Unfortunately I'm only able to code with Purebasic, the rest is just too complicated for me
Re: Use a C++ DLL
Hi Polo,
Forgive me if I'm missing something, but there are two PB files which are used in co-ordination with the dll.
Here is a small code snippet from RW_FreeImage_Inc.pb (the other is: RW_FreeImage_Res.pb
I've been trying to find the author of this wrapper, no success so far.
If I'm wasting your time with this, please let me know.
Regards
Dave
Forgive me if I'm missing something, but there are two PB files which are used in co-ordination with the dll.
Here is a small code snippet from RW_FreeImage_Inc.pb (the other is: RW_FreeImage_Res.pb
Code: Select all
XIncludeFile "RW_FreeImage_Res.pb"
;- Imports
Import "FreeImage.lib"
; Init / error routines
FreeImage_Initialise(load_local_plugins_only.l = #False) As "_FreeImage_Initialise@4"
FreeImage_DeInitialise() As "_FreeImage_DeInitialise@0"
; Version routines
RWFreeImage_GetVersion() As "_FreeImage_GetVersion@0"
RWFreeImage_GetCopyrightMessage() As "_FreeImage_GetCopyrightMessage@0"
; message output functions
FreeImage_OutputMessageProc() As "_FreeImage_OutputMessageProc"
FreeImage_SetOutputMessage(omf.l) As "_FreeImage_SetOutputMessage@4" ;omf.l = pointeur de callback : FreeImage_OutputMessageFunction(fif.l, msg.l) ; fif = FREE_IMAGE_FORMAT ; msg = @String
; Allocate / Clone / Unload routines
FreeImage_Allocate(width.l,height.l,bpp.l,red_mask.l = 0,green_mask.l=0,blue_mask.l=0) As "_FreeImage_Allocate@24"
FreeImage_AllocateT(type.l,width.l,height.l,bpp.l=8,red_mask.l = 0,green_mask.l=0,blue_mask.l=0) As "_FreeImage_AllocateT@28"
FreeImage_Clone(dib.l) As "_FreeImage_Clone@4" ; dib = *ptr.FIBITMAP
FreeImage_Unload(dib.l) As "_FreeImage_Unload@4" ; dib = *ptr.FIBITMAP
; Load / Save routinesIf I'm wasting your time with this, please let me know.
Regards
Dave
DE AA EB
Re: Use a C++ DLL
unfortunately there is no COM-DLL in the SDK so you cannot access it via COMate.Polo wrote:I've seen the tutorial, seems I have to "register" that com thing.
There is a COM-Wrapper for DotNet but i think this is no option for you.
Greetings ... Kiffi
Hygge
Re: Use a C++ DLL
There's something called COM Wrapper in the SDK so I assumed that was a COM DLL?Kiffi wrote:unfortunately there is no COM-DLL in the SDK so you cannot access it via COMate.Polo wrote:I've seen the tutorial, seems I have to "register" that com thing.
There is a COM-Wrapper for DotNet but i think this is no option for you.
Greetings ... Kiffi
Dave, the thing is I cannot use Import to import the DLL functions for some reason
Re: Use a C++ DLL
no, it's a DotNet-DLL.Polo wrote:There's something called COM Wrapper in the SDK so I assumed that was a COM DLL?
Greetings ... Kiffi
Hygge
Re: Use a C++ DLL
Oh ok, well, guess I still have to wrap the DLL. Drives me nuts!
Re: Use a C++ DLL
perhaps this may help, original information found at http://www.freebasic.net/forum/viewtopi ... highlight=
was easy to adapt to MS Visual Studio tools, basically you make a def file that gives unmangled names to the mangled names.
I only did one unmangled function in the example: EdgeOrientPoint="??0CEdgeOrientPoints@@QAE@XZ"
but you should get the idea, once you have the def file, place it in the same folder where the dll resides,
then launch Command Prompt and CD the that folder.
run the batch file "vcvarsall.bat" that's in C:\Program Files\Microsoft Visual Studio 9.0\VC
then at command prompt do
lib /DEF:SBSDK-vc100-mt-11.0.0.def /MACHINE:X86
it will make an import lib which you may then use with PB Import
don't know if this will work though, have no idea what the proper initialization and clean up functions may need to be called.
save the following as "SBSDK-vc100-mt-11.0.0.def"
was easy to adapt to MS Visual Studio tools, basically you make a def file that gives unmangled names to the mangled names.
I only did one unmangled function in the example: EdgeOrientPoint="??0CEdgeOrientPoints@@QAE@XZ"
but you should get the idea, once you have the def file, place it in the same folder where the dll resides,
then launch Command Prompt and CD the that folder.
run the batch file "vcvarsall.bat" that's in C:\Program Files\Microsoft Visual Studio 9.0\VC
then at command prompt do
lib /DEF:SBSDK-vc100-mt-11.0.0.def /MACHINE:X86
it will make an import lib which you may then use with PB Import
don't know if this will work though, have no idea what the proper initialization and clean up functions may need to be called.
save the following as "SBSDK-vc100-mt-11.0.0.def"
LIBRARY SBSDK-vc100-mt-11.0.0.dll
EXPORTS
EdgeOrientPoint="??0CEdgeOrientPoints@@QAE@XZ"
Re: Use a C++ DLL
Any chance a skilled c++ programmer could write a wrapper for this c++ dll? Even if it's just one function, to get me started?
Re: Use a C++ DLL
I could do it, but it's not easy cos you have to know the function calling convention, the vTable structure, etc...Polo wrote:Any chance a skilled c++ programmer could write a wrapper for this c++ dll? Even if it's just one function, to get me started?
It would probably be something this: http://www.purebasic.fr/english/viewtop ... 12&t=52662
Re: Use a C++ DLL
I know nothing about that unfortunately 
Re: Use a C++ DLL
Here's an example:
SBSDKTypes.pbi
SBSDK2Advanced.pbi
SBSDK2.pbi
Example:
SBSDKTypes.pbi
Code: Select all
CompilerIf Defined(_SBSDKTYPES_H, #PB_Constant) = 0
#_SBSDKTYPES_H = 1
#SBSDK_REG_ID = 1
#SBSDK2_REG_ID = 2
#SBSDK_NON_PROJECTED_RANGE = 4096
; Model numbers
#SB_MODEL_SC4 = $80 ;SC4 (byte 4)
#SB_MODEL_SC5 = $81 ;SC5 (byte 4)
#SB_MODEL_SC6 = $82 ;SC6 (byte 4)
#SB_MODEL_SC4_PLASMA = $83 ;SC4 Plasma (byte 4)
#SB_MODEL_SC6_8N1 = $84 ;SC6 8N1 (byte 4)
#SB_MODEL_SC7 = $85 ;SC7 (byte 4)
#SB_MODEL_CRANE = $86 ;Crane (byte 4)
#SB_MODEL_SYMPODIUM = $87 ;Sympodium (byte 4)
#SB_MODEL_ROOM_CONTROL = $88 ;Room Control (byte 4)
#SB_MODEL_XPORT30 = $89 ;XPort 30 (byte 4)
#SB_MODEL_WONDERBAR = $8A ;Wonderbar (byte 4)
#SB_MODEL_XBOW = $8B ;SC8(DViT) (byte 4)
#SB_SOFT_SERIAL_SWITCH = $8C ;Soft serial switch (byte 4)
#SB_MODEL_BLUEWAVE = $8e ;DT770
#SB_MODEL_MAGNUS = $8f ;SB600
#SB_MODEL_SPEAR = $90 ;Interactive Display Frame
#SB_MODEL_CARRERA = $90 ;Interactive Display Frame
#SB_MODEL_COMPASS = $91 ;compass
#SB_MODEL_COBRA = $92 ;cobra
#SB_MODEL_NAHANNI = $93 ;CS-Nahanni
#SB_MODEL_ERIE = $94 ;CS-Erie
#SB_MODEL_FRASER = $95 ;CS-Fraser
#SB_MODEL_VIPER = $96 ;VIPER
#SB_MODEL_BEETLE = $97 ;beetle
#SB_MODEL_DASH = $98 ;SBD600 (SC9)
#SB_MODEL_MERCURY = $99 ;SBX800
#SB_MODEL_DASH2 = $9A ;SBD600 (SC12)
#SB_MODEL_CARRERA_IFP = $9B ;6052i interactive display
#SB_MODEL_MERCURY_XT = $9C ;SBX800 extender
#SB_MODEL_SBID_8070I = $9D ;8070i interactive display
#SB_MODEL_WC8 = $9E ;SBX800 wireless module
#SB_MODEL_SEVILLE = $9F ;SB480
#SB_MODEL_PODIUM_PHASE1_18 = $A0 ;Podium 18"
#SB_MODEL_PODIUM_PHASE1_24 = $A1 ;Podium 24"
#SB_MODEL_NW2700 = $A2 ;NextWindow 2700 overlay
#SB_MODEL_PODIUM_PHASE2_18 = $A3 ;Podium 18" phase 2
#SB_MODEL_PODIUM_PHASE2_24 = $A4 ;Podium 24" phase 2
#SB_MODEL_SBID_8055I = $A5 ;8055i interactive display
#SB_MODEL_PROJECTOR_UF75WI = $A6 ;UF75WI interactive projector
#SB_MODEL_OREGON = $A7 ;Oregon
; For the slate and the ID250 we have to make up a model number because
; they don't have a model number query. To not conflict with other id's
; they start at = $40.
#SB_MODEL_SMART_SLATE_WS100 = $40 ;SmartSlateWS100
#SB_MODEL_SYMPODIUM_ID250 = $41 ;SympodiumID250
#SB_MODEL_SYMPODIUM_ID350 = $42 ;SympodiumID350
#SB_MODEL_SYMPODIUM_ID370 = $43 ;SympodiumID370
#SB_MODEL_SMART_TABLE = $44 ;SMART Table
#SB_MODEL_SYMPODIUM_ID420 = $45 ;SympodiumID420
#SB_MODEL_SMART_SLATE_WS200 = $46 ;SmartSlateWS200
Macro SBSDK_UINT
l
EndMacro
Macro SBSDK_DWORD
l
EndMacro
Macro SBSDK_COLORREF
l
EndMacro
Enumeration ; SBSDK_TOOL_TYPE
#SB_NO_TOOL = 0
#SB_PEN
#SB_ERASER
#SB_RECTANGLE
#SB_LINE
#SB_CIRCLE
#SB_POLYGON
#SB_STAMP
EndEnumeration
Macro SBSDK_TOOL_TYPE
l
EndMacro
Enumeration ; SBSDK_MOUSE_EVENT_FLAG
#SB_MEF_DEFAULT = 0
#SB_MEF_ALWAYS ; Deprecated, use SB_MEF_ALWAYS_2 instead.
#SB_MEF_NEVER
#SB_MEF_ALWAYS_2
EndEnumeration
Macro SBSDK_MOUSE_EVENT_FLAG
l
EndMacro
Enumeration ; SBSDK_TOOL_CHANGE_TYPE
#SB_TCT_STANDARD = 0
#SB_TCT_XML
#SB_TCT_XML_AND_AFTER_FLOATING_TOOLS
#SB_TCT_XML_ALL
EndEnumeration
Macro SBSDK_TOOL_CHANGE_TYPE
l
EndMacro
Enumeration ; SB_BOARD_STATUS
#SB_BOARD_OPEN ;// This SMART Board is working properly.
#SB_BOARD_CLOSED ;//This SMART Board is Not currently active. (The port is closed)
#SB_BOARD_DEVICE_IN_USE ;//The port For this device is in use by another application.
#SB_BOARD_DEVICE_NOT_FOUND ;//The port For this device could Not be found
#SB_BOARD_DEVICE_NOT_PRESENT ;//This SMART Board is unplugged Or Not available.
#SB_BOARD_NO_DATA ;//No Data is being received on this port.
#SB_BOARD_ANALYZING_DATA ;//Analyzing incoming Data To determine If it is a SMART Board...
#SB_BOARD_NOT_RESPONDING ;//Data is being received, but communication To the SMART Board is Not working correctly. The LEDs will Not function properly.
#SB_BOARD_DISABLED ;//Board has been disabled by registry setting.
#SB_BOARD_USB_UNPLUGGED ;//The USB dongle is plugged in but Not connected To the SMART Board.
#SB_BOARD_ERROR ;//ServiceSetting.h has this
#SB_BOARD_CALIBRATION_NEEDED ;//This SMART Board needs initial calibration
#SB_BOARD_OPEN_PRIVATE ;//The board is open but should Not be shown in the control panel Or diagnostics. It counts As a board that is open which allows our apps To be enabled. It is used For remote boards.
#SB_BOARD_LIMITED_FUNCTIONALITY ;//The board is working but in a limited way.
EndEnumeration
Macro SB_BOARD_STATUS
l
EndMacro
Enumeration ; SBSDK_MOUSE_STATE
#SB_MOUSE_LEFT_CLICK
#SB_MOUSE_MIDDLE_CLICK
#SB_MOUSE_RIGHT_CLICK
#SB_MOUSE_CTRL_CLICK
#SB_MOUSE_ALT_CLICK
#SB_MOUSE_SHIFT_CLICK
#SB_MOUSE_FLOAT_CLICK
#SB_MOUSE_NEXT_CLICK_NOT_SET
#SB_MOUSE_ERASER_CLICK
#SB_MOUSE_PEN_CLICK
#SB_MOUSE_FINGER_CLICK
EndEnumeration
Macro SBSDK_MOUSE_STATE
l
EndMacro
Enumeration ; SBSDK_PROXIMITY_STATE
#SB_PROXIMITY_DETECT_NONE = 0 ;// 0000
#SB_PROXIMITY_DETECT_RIGHT ;// 0001
#SB_PROXIMITY_DETECT_CENTRE ;// 0010
#SB_PROXIMITY_DETECT_CENTRE_RIGHT ;// 0011
#SB_PROXIMITY_DETECT_LEFT ;// 0100
#SB_PROXIMITY_DETECT_LEFT_RIGHT ;// 0101
#SB_PROXIMITY_DETECT_LEFT_CENTRE ;// 0110
#SB_PROXIMITY_DETECT_LEFT_CENTRE_RIGHT ;// 0111
EndEnumeration
Macro SBSDK_PROXIMITY_STATE
l
EndMacro
Enumeration ; SBSDK_PEN_TRAY_TOOL
#SBSDK_PTT_NONE = 0
#SBSDK_PTT_ERASER
#SBSDK_PTT_BLACK_PEN
#SBSDK_PTT_BLUE_PEN
#SBSDK_PTT_RED_PEN
#SBSDK_PTT_GREEN_PEN
EndEnumeration
Macro SBSDK_PEN_TRAY_TOOL
l
EndMacro
Enumeration ; SBSDK_SEND_XML_ERR
#SBSDK_SXE_XML_FAILED = -1
#SBSDK_SXE_XML_UNKNOWN = 0
#SBSDK_SXE_XML_SENT_AS_XML = 1
#SBSDK_SXE_XML_SENT_AS_PTS = 2
EndEnumeration
Macro SBSDK_SEND_XML_ERR
l
EndMacro
Enumeration ; SBSDK_BUTTON_ACTION
#SB_PRINT = 1
#SB_NEXT
#SB_PREVIOUS
#SB_CLEAR
#SB_RIGHT_MOUSE
#SB_MIDDLE_MOUSE
#SB_FLOAT_MOUSE
#SB_KEYBOARD
#SB_FLOATINGTOOLS
#SB_NOTEBOOK
#SB_SCREENCAPTURE
#SB_NOTOOLS
#SB_ERASERBUTTON
#SB_BLACKPEN
#SB_BLUEPEN
#SB_REDPEN
#SB_GREENPEN
#SB_DISABLED
#SB_ORIENT
#SB_POWER
#SB_ACTIVE_PEN_TIP
#SB_ACTIVE_PEN_ERASER
#SB_WINDOWS_KEYBOARD
EndEnumeration
Macro SBSDK_BUTTON_ACTION
l
EndMacro
Enumeration ; SBSDK_ERR
#SBE_OK = 0
#SBE_UNKNOWN = -1
#SBE_TIMEOUT = -2
#SBE_NOT_CONNECTED = -3
#SBE_NO_IMPLEMENTATION = -4
#SBE_FAILED = -5
#SBE_BAD_PARAMETER = -6
EndEnumeration
Macro SBSDK_ERR
l
EndMacro
Enumeration ; SBSDK_CONTACT_STATE
#SB_CONTACT_NONE = 0
#SB_CONTACT_DOWN
#SB_CONTACT_MOVE
#SB_CONTACT_UP
#SB_CONTACT_HOVER
EndEnumeration
Macro SBSDK_CONTACT_STATE
l
EndMacro
Enumeration ; SBSDK_GESTURE_EVENT_FLAG
#SB_GEF_DEFAULT = 0
#SB_GEF_SEND_THROUGH_SDK ;// right click And scroll still go through the OS
#SB_GEF_SEND_THROUGH_OS
#SB_GEF_SEND_ALL_THROUGH_SDK
#SB_GEF_SEND_NONE
EndEnumeration
Macro SBSDK_GESTURE_EVENT_FLAG
l
EndMacro
Enumeration ; SBSDK_GESTURE_TYPE
#SB_GT_PAN = 0
#SB_GT_SCALE
#SB_GT_ROTATE
#SB_GT_SWIPE
#SB_GT_RIGHT_CLICK
#SB_GT_MIDDLE_CLICK
#SB_GT_ERASE
EndEnumeration
Macro SBSDK_GESTURE_TYPE
l
EndMacro
Enumeration ; SBSDK_CAPTURE_FLAG
#SB_CF_NONE = 0
#SB_CF_CAPTURE_PEN
#SB_CF_CAPTURE_FINGER
#SB_CF_CAPTURE_ALL
EndEnumeration
Macro SBSDK_CAPTURE_FLAG
l
EndMacro
Enumeration ; SBSDK_BOARD_CAPABILITIES
#SB_BC_DUAL_TOUCH = 0 ;// 0 Or 1, This is refering To SB6D dual touch mode which is different from multi touch.
#SB_BC_25_PT_CALIBRATION ;// 0 Or 1
#SB_BC_ASIC_CAMERA_IMPLEMENTATION ;// 0 Or 1
#SB_BC_PROXIMITY_IMPLEMENTATION
EndEnumeration
Macro SBSDK_BOARD_CAPABILITIES
l
EndMacro
Enumeration ; SBSDK_TOOL_DETAIL
#SBSDK_TD_STANDARD = 0
#SBSDK_TD_EXTENDED
EndEnumeration
Macro SBSDK_TOOL_DETAIL
l
EndMacro
Structure CSBSDKWnd Align #PB_Structure_AlignC
m_hWnd.i
EndStructure
CompilerEndIfCode: Select all
CompilerIf Defined(_SBSDK2ADVANCED_H, #PB_Constant) = 0
#_SBSDK2ADVANCED_H = 1
XIncludeFile "SBSDK2.pbi"
;CSBSDK2AdvancedEventHandler - PROTOTYPES
Prototype P_CSBSDK2AdvancedEventHandler_Destructor(unknown.a=1)
Prototype P_CSBSDK2AdvancedEventHandler_OnDViTTrackerData(iBoardNumber.l, ucData1.a, ucData2.a, ucData3.a)
Prototype P_CSBSDK2AdvancedEventHandler_OnDViTTrackerDataEx(iBoardNumber.l, iCameras.l, *pCameraTargetLists)
Prototype P_CSBSDK2AdvancedEventHandler_OnDViTRawWidthHeight(iWidth.l, iHeight.l, iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnDViTAspectRatioAndDeltaAngles(dAspectRatio.d, dAngle1.d, dAngle2.d, dAngle3.d, dAngle4.d)
Prototype P_CSBSDK2AdvancedEventHandler_OnDViTCameraPositions(iBoardNumber.l, fHeight1.f, fWidth1.f, fHeight2.f, fWidth2.f)
;// Projected Raw (X,Y) events.
Prototype P_CSBSDK2AdvancedEventHandler_OnXYDownRaw(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnXYMoveRaw(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnXYUpRaw(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnXYHoverRaw(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnRightMouse(iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnMiddleMouse(iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnFloatMouse(iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnKeyboard(iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnPenTrayButton(baButton.l, iPointerID.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnDViTMultiPointerMode(iBoardNumber.l, bOn.b)
Prototype P_CSBSDK2AdvancedEventHandler_OnMouseStateChange(iMouseState.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnRawDataFromController(iBoardNumber.l, iMessage.l, *pBuff.Ascii, iLen.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnMultiPointContact(*list)
Prototype P_CSBSDK2AdvancedEventHandler_OnGestureDown(iGestureId.l, *wnd, iType.l, x.l, y.l, fRotation.f, fScale.f)
Prototype P_CSBSDK2AdvancedEventHandler_OnGestureMove(iGestureId.l, *wnd, iType.l, x.l, y.l, fRotation.f, fScale.f)
Prototype P_CSBSDK2AdvancedEventHandler_OnGestureUp(iGestureId.l, *wnd, iType.l, x.l, y.l, fRotation.f, fScale.f)
Prototype P_CSBSDK2AdvancedEventHandler_OnGestureDownEx(iGestureId.l, *wnd, iType.l, x.l, y.l, fRotation.f, fScale.f, x0.l, y0.l, x1.l, y1.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnGestureMoveEx(iGestureId.l, *wnd, iType.l, x.l, y.l, fRotation.f, fScale.f, x0.l, y0.l, x1.l, y1.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnGestureUpEx(iGestureId.l, *wnd, iType.l, x.l, y.l, fRotation.f, fScale.f, x0.l, y0.l, x1.l, y1.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnBoardCapabilities(iBoardNumber.l, iCapability.l, iValue.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnProximityStateChange(iBoardNumber.l, iProximityState.l)
Prototype P_CSBSDK2AdvancedEventHandler_OnWindowState(iState.l, *wnd, iFlags.l, iAppId.l)
Structure CSBSDK2AdvancedEventHandler_vTable Align #PB_Structure_AlignC
Destructor.P_CSBSDK2AdvancedEventHandler_Destructor
OnDViTTrackerData.P_CSBSDK2AdvancedEventHandler_OnDViTTrackerData
OnDViTTrackerDataEx.P_CSBSDK2AdvancedEventHandler_OnDViTTrackerDataEx
OnDViTRawWidthHeight.P_CSBSDK2AdvancedEventHandler_OnDViTRawWidthHeight
OnDViTAspectRatioAndDeltaAngles.P_CSBSDK2AdvancedEventHandler_OnDViTAspectRatioAndDeltaAngles
OnDViTCameraPositions.P_CSBSDK2AdvancedEventHandler_OnDViTCameraPositions
OnXYDownRaw.P_CSBSDK2AdvancedEventHandler_OnXYDownRaw
OnXYMoveRaw.P_CSBSDK2AdvancedEventHandler_OnXYMoveRaw
OnXYUpRaw.P_CSBSDK2AdvancedEventHandler_OnXYUpRaw
OnXYHoverRaw.P_CSBSDK2AdvancedEventHandler_OnXYHoverRaw
OnRightMouse.P_CSBSDK2AdvancedEventHandler_OnRightMouse
OnMiddleMouse.P_CSBSDK2AdvancedEventHandler_OnMiddleMouse
OnFloatMouse.P_CSBSDK2AdvancedEventHandler_OnFloatMouse
OnKeyboard.P_CSBSDK2AdvancedEventHandler_OnKeyboard
OnPenTrayButton.P_CSBSDK2AdvancedEventHandler_OnPenTrayButton
OnDViTMultiPointerMode.P_CSBSDK2AdvancedEventHandler_OnDViTMultiPointerMode
OnMouseStateChange.P_CSBSDK2AdvancedEventHandler_OnMouseStateChange
OnRawDataFromController.P_CSBSDK2AdvancedEventHandler_OnRawDataFromController
OnMultiPointContact.P_CSBSDK2AdvancedEventHandler_OnMultiPointContact
OnGestureDown.P_CSBSDK2AdvancedEventHandler_OnGestureDown
OnGestureMove.P_CSBSDK2AdvancedEventHandler_OnGestureMove
OnGestureUp.P_CSBSDK2AdvancedEventHandler_OnGestureUp
OnGestureDownEx.P_CSBSDK2AdvancedEventHandler_OnGestureDownEx
OnGestureMoveEx.P_CSBSDK2AdvancedEventHandler_OnGestureMoveEx
OnGestureUpEx.P_CSBSDK2AdvancedEventHandler_OnGestureUpEx
OnBoardCapabilities.P_CSBSDK2AdvancedEventHandler_OnBoardCapabilities
OnProximityStateChange.P_CSBSDK2AdvancedEventHandler_OnProximityStateChange
OnWindowState.P_CSBSDK2AdvancedEventHandler_OnWindowState
EndStructure
Structure CSBSDK2AdvancedEventHandler Align #PB_Structure_AlignC
*vTable.CSBSDK2AdvancedEventHandler_vTable
EndStructure
CompilerEndIfCode: Select all
CompilerIf Defined(_CSBSDK2_H, #PB_Constant) = 0
#_CSBSDK2_H = 1
XIncludeFile "SBSDKTypes.pbi"
;- CSBSDK2EventHandler - PROTOTYPES
Prototype P_CSBSDK2EventHandler_Destructor(unknown.a=1)
;// Projected (X,Y) events.
Prototype P_CSBSDK2EventHandler_OnXYDown(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnXYMove(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnXYUp(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnXYHover(x.l, y.l, z.l, iPointerID.l)
;// Non-projected (X,Y) events.
Prototype P_CSBSDK2EventHandler_OnXYNonProjectedDown(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnXYNonProjectedMove(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnXYNonProjectedUp(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnXYNonProjectedHover(x.l, y.l, z.l, iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnXMLAnnotW(*szXMLAnnot)
Prototype P_CSBSDK2EventHandler_OnXMLAnnotA(*szXMLAnnot)
Prototype P_CSBSDK2EventHandler_OnNoTool(iBoardID.l)
Prototype P_CSBSDK2EventHandler_OnPen(iBoardID.l)
Prototype P_CSBSDK2EventHandler_OnEraser(iBoardID.l)
Prototype P_CSBSDK2EventHandler_OnRectangle(iBoardID.l)
Prototype P_CSBSDK2EventHandler_OnLine(iBoardID.l)
Prototype P_CSBSDK2EventHandler_OnCircle(iBoardID.l)
Prototype P_CSBSDK2EventHandler_OnStamp(iBoardID.l)
Prototype P_CSBSDK2EventHandler_OnXMLToolChangeW(iBoardID.l, *szXMLTool)
Prototype P_CSBSDK2EventHandler_OnXMLToolChangeA(iBoardID.l, *szXMLTool)
Prototype P_CSBSDK2EventHandler_OnPrint(iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnNext(iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnPrevious(iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnClear(iPointerID.l)
Prototype P_CSBSDK2EventHandler_OnSBSDKBoardStatusChange()
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
Prototype.b P_CSBSDK2EventHandler_OnMessageReceived()
CompilerEndIf
;- CSBSDK2 - PROTOTYPES
Prototype.i P_New_CSBSDK2(bSeperateConnection.b = #False)
Prototype P_CSBSDK2_Destructor(unknown.a=1)
Prototype P_CSBSDK2_SetEventHandler(*pHandler)
Prototype P_CSBSDK2_SBSDKAttach(*Wnd, bSendXMLAnnotations.b = #False)
Prototype P_CSBSDK2_SBSDKAttachProcess(dProcID.l, bSendXMLAnnotations.b)
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
Prototype P_CSBSDK2_SBSDKAttachWithMsgWnd(*Wnd, bSendXMLAnnotations.b, *WndProcessData)
CompilerEndIf
Prototype P_CSBSDK2_SBSDKDetachProcess(dProcID.l, bTerminateSession.b = #False)
Prototype P_CSBSDK2_SBSDKDetachWnd(*Wnd)
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
Prototype P_CSBSDK2_SBSDKWindowMoved(*AttachedWnd)
Prototype P_CSBSDK2_SBSDKWindowHasFocus(*AttachedWnd, bFocus.b)
Prototype P_CSBSDK2_SBSDKWindowLevel(*AttachedWnd, iLevel.l)
CompilerEndIf
Prototype.i P_CSBSDK2_SBSDKGetXYDestinationWnd()
;// Handle this message and call SBSDKProcessData.
;Prototype P_CSBSDK2_SBSDK_NEW_MESSAGE
Prototype P_CSBSDK2_SBSDKProcessData()
Prototype.l P_CSBSDK2_SBSDKGetToolType(iPointerID.l)
Prototype.l P_CSBSDK2_SBSDKGetToolColor(iPointerID.l)
Prototype.f P_CSBSDK2_SBSDKGetToolOpacity(iPointerID.l)
Prototype.l P_CSBSDK2_SBSDKGetToolFillColor(iPointerID.l)
Prototype.l P_CSBSDK2_SBSDKSendXMLToolChanges(bSendXMLToolChanges.b)
Prototype.l P_CSBSDK2_SBSDKSendToolChanges(iSendToolChanges.l)
Prototype.i P_CSBSDK2_SBSDKGetXMLToolW(iPointerID.l)
Prototype.i P_CSBSDK2_SBSDKGetXMLToolA(iPointerID.l)
Prototype P_CSBSDK2_SBSDKSendMouseEvents(*AttachedWnd, iFlag.l, iPointerID.l)
Prototype.b P_CSBSDK2_SBSDKIsABoardConnected()
Prototype.l P_CSBSDK2_SBSDKGetConnectedBoardCount()
Prototype.l P_CSBSDK2_SBSDKGetBoardCount()
Prototype.b P_CSBSDK2_SBSDKIsBoardProjected(iPointerID.l)
Prototype.l P_CSBSDK2_SBSDKGetBoardNumberFromPointerID(iPointerID.l)
Prototype.b P_CSBSDK2_SBSDKGetSoftwareVersion(*piMajor, *piMinor, *piUpdate, *piBuild)
Prototype.l P_CSBSDK2_SBSDKGetCurrentBoard()
Prototype P_CSBSDK2_SBSDKGetCurrentTool()
Prototype.l P_CSBSDK2_SBSDKSendToolChangesForAllBoards(iToolDetail.l)
Prototype.i P_CSBSDK2_GetSBSDKInternal()
Structure CSBSDK2EventHandler_vTable Align #PB_Structure_AlignC
Destructor.P_CSBSDK2EventHandler_Destructor
OnXYDown.P_CSBSDK2EventHandler_OnXYDown
OnXYMove.P_CSBSDK2EventHandler_OnXYMove
OnXYHover.P_CSBSDK2EventHandler_OnXYHover
OnXYNonProjectedDown.P_CSBSDK2EventHandler_OnXYNonProjectedDown
OnXYNonProjectedMove.P_CSBSDK2EventHandler_OnXYNonProjectedMove
OnXYNonProjectedUp.P_CSBSDK2EventHandler_OnXYNonProjectedUp
OnXYNonProjectedHover.P_CSBSDK2EventHandler_OnXYNonProjectedHover
OnXMLAnnotW.P_CSBSDK2EventHandler_OnXMLAnnotW
OnXMLAnnotA.P_CSBSDK2EventHandler_OnXMLAnnotA
OnNoTool.P_CSBSDK2EventHandler_OnNoTool
OnPen.P_CSBSDK2EventHandler_OnPen
OnEraser.P_CSBSDK2EventHandler_OnEraser
OnRectangle.P_CSBSDK2EventHandler_OnRectangle
OnLine.P_CSBSDK2EventHandler_OnLine
OnCircle.P_CSBSDK2EventHandler_OnCircle
OnStamp.P_CSBSDK2EventHandler_OnStamp
OnXMLToolChangeW.P_CSBSDK2EventHandler_OnXMLToolChangeW
OnXMLToolChangeA.P_CSBSDK2EventHandler_OnXMLToolChangeA
OnPrint.P_CSBSDK2EventHandler_OnPrint
OnNext.P_CSBSDK2EventHandler_OnNext
OnPrevious.P_CSBSDK2EventHandler_OnPrevious
OnClear.P_CSBSDK2EventHandler_OnClear
OnSBSDKBoardStatusChange.P_CSBSDK2EventHandler_OnSBSDKBoardStatusChange
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
OnMessageReceived.P_CSBSDK2EventHandler_OnMessageReceived
CompilerEndIf
EndStructure
Structure CSBSDK2EventHandler
*vTable.CSBSDK2EventHandler_vTable
EndStructure
Structure CSBSDK2_vTable Align #PB_Structure_AlignC
Destructor.P_CSBSDK2_Destructor
EndStructure
Structure CSBSDK2 Align #PB_Structure_AlignC
*vTable.CSBSDK2_vTable
*m_pSBSDKInternal
m_bSeperateConnection.b
EndStructure
CompilerEndIfCode: Select all
; http://msdn.microsoft.com/en-us/library/ek8tkfbw%28v=vs.80%29.aspx
Macro thiscall_inline(this)
EnableASM
MOV ECX, this
DisableASM
EndMacro
Macro thiscall_var(this)
!mov ecx, [p.v_#this]
EndMacro
Macro thiscall_ptr(this)
!mov ecx, [p.p_#this]
EndMacro
IncludePath "include"
XIncludeFile "SBSDK2.pbi"
#DLL_PATH = "..\DLL\bin\"
#DLL_NAME = #DLL_PATH+ "SBSDK-vc100-mt-11.0.0.dll"
Global Window_0
Global Container_0
Global New_CSBSDK2.P_New_CSBSDK2
Global CSBSDK2_SBSDKAttach.P_CSBSDK2_SBSDKAttach
Global CSBSDK2_SBSDKAttachWithMsgWnd.P_CSBSDK2_SBSDKAttachWithMsgWnd
Global CSBSDK2_SetEventHandler.P_CSBSDK2_SetEventHandler
Global CSBSDK2_SBSDKGetSoftwareVersion.P_CSBSDK2_SBSDKGetSoftwareVersion
Global *SBSDK_NEW_MESSAGE.LONG
Global *sbsdk2.CSBSDK2
Global myWindow.CSBSDKWnd
Procedure OpenWindow_0()
Window_0 = OpenWindow(#PB_Any, 0, 0, 720, 470, "SMART Board Test", #PB_Window_SystemMenu)
Container_0 = ContainerGadget(#PB_Any, 30, 40, 630, 400)
CloseGadgetList()
EndProcedure
Procedure.i Load_SBSDK(Filename.s)
Protected hLib.i
hLib = OpenLibrary(#PB_Any, Filename)
If hLib
New_CSBSDK2 = GetFunction(hLib, "??0CSBSDK2@@QAE@_N@Z")
CSBSDK2_SBSDKAttach = GetFunction(hLib, "?SBSDKAttach@CSBSDK2@@QAEXAAVCSBSDKWnd@@_N@Z")
CSBSDK2_SBSDKAttachWithMsgWnd = GetFunction(hLib, "?SBSDKAttachWithMsgWnd@CSBSDK2@@QAEXAAVCSBSDKWnd@@_NV2@@Z")
CSBSDK2_SetEventHandler = GetFunction(hLib, "?SetEventHandler@CSBSDK2@@QAEXPAVCSBSDK2EventHandler@@@Z")
CSBSDK2_SBSDKGetSoftwareVersion = GetFunction(hLib, "?SBSDKGetSoftwareVersion@CSBSDK2@@QAE_NPAH000@Z")
*SBSDK_NEW_MESSAGE = GetFunction(hLib, "?SBSDK_NEW_MESSAGE@CSBSDK2@@2IA")
EndIf
ProcedureReturn hLib
EndProcedure
;---------------------------------------------------------
Procedure Event_OnXYDown(x.l, y.l, z.l, iPointerID.l)
Debug "Event_OnXYDown - called"
EndProcedure
Procedure Event_OnXYMove(x.l, y.l, z.l, iPointerID.l)
Debug "Event_OnXYMove - called"
EndProcedure
Procedure Event_OnClear(iPointerID.l)
Debug "Event_OnClear - called"
EndProcedure
;---------------------------------------------------------
Procedure.i CreateEventHandler()
Protected *vtbl.CSBSDK2EventHandler_vTable
Protected *New_CSBSDK2EventHandler.CSBSDK2EventHandler
*vtbl = AllocateMemory(SizeOf(CSBSDK2EventHandler_vTable))
*vtbl\OnXYDown = @Event_OnXYDown()
*vtbl\OnXYMove = @Event_OnXYMove()
*vtbl\OnClear = @Event_OnClear()
*New_CSBSDK2EventHandler = AllocateMemory(SizeOf(CSBSDK2EventHandler))
*New_CSBSDK2EventHandler\vTable = *vtbl
ProcedureReturn *New_CSBSDK2EventHandler
EndProcedure
Structure bla
sex.c[200]
EndStructure
Procedure Init_SMARTBoard(hWnd.i)
Protected win.CSBSDKWnd
Protected EventHandler.i
*sbsdk2 = New_CSBSDK2()
Debug "*sbsdk2: "+Hex(*sbsdk2)
myWindow\m_hWnd = hWnd
thiscall_inline(*sbsdk2)
CSBSDK2_SBSDKAttachWithMsgWnd(@win, 0, @myWindow)
EventHandler = CreateEventHandler()
thiscall_inline(*sbsdk2)
CSBSDK2_SetEventHandler(EventHandler)
EndProcedure
Procedure WinCallback(WindowID, Message, WParam, LParam)
Result = #PB_ProcessPureBasicEvents
If Message = *SBSDK_NEW_MESSAGE\l
Debug "Smart Board msg"
EndIf
ProcedureReturn Result
EndProcedure
If Not Load_SBSDK(#DLL_NAME)
Debug "Failed to load: "+#DQUOTE$+#DLL_NAME+#DQUOTE$
EndIf
OpenWindow_0()
SetWindowCallback(@WinCallback())
Init_SMARTBoard(WindowID(Window_0))
Repeat
Event = WindowEvent()
Until Event = #PB_Event_CloseWindowRe: Use a C++ DLL
Oh my god, thanks Toni, I'll try it out tomorrow at work with a SmartBoard!!
Saw you've got the following prototypes, any idea on how to get and call the actual functions?
Prototype.l P_CSBSDK2_SBSDKGetToolType(iPointerID.l)
Prototype.l P_CSBSDK2_SBSDKGetToolColor(iPointerID.l)
Prototype.f P_CSBSDK2_SBSDKGetToolOpacity(iPointerID.l)
Prototype.l P_CSBSDK2_SBSDKGetToolFillColor(iPointerID.l)
Thanks again, really appreciated, especially if it works it means I haven't got to make a wrapper in C++ which is a brilliant thing!
Saw you've got the following prototypes, any idea on how to get and call the actual functions?
Prototype.l P_CSBSDK2_SBSDKGetToolType(iPointerID.l)
Prototype.l P_CSBSDK2_SBSDKGetToolColor(iPointerID.l)
Prototype.f P_CSBSDK2_SBSDKGetToolOpacity(iPointerID.l)
Prototype.l P_CSBSDK2_SBSDKGetToolFillColor(iPointerID.l)
Thanks again, really appreciated, especially if it works it means I haven't got to make a wrapper in C++ which is a brilliant thing!

