Attribute VB_Name = "Module1"
' Non-existent documentation...   why doesn't XC_CopyFrameBuffer work??

'C++ Function Prototypes from header file (They may work, but I haven't personally tested)
' virtual void XCamera::Blit  (void * where, int x, int y, int w, int h, BlitType type ) [pure virtual]

' virtual void XCamera::CaptureImage  (  ) [pure virtual]

' virtual ErrCode XCamera::CopyFrameBuffer  ( void * buffer, unsigned int size ) [pure virtual]


' VB6 Function Declarations... the first two are fine, but the third doesnt work yet
Private Declare Function XC_CaptureImage Lib "xcamera" (ByVal handle As Long) As Long
Private Declare Function XC_Blit Lib "xcamera" (ByVal handle As Long, ByVal windowhandle As Long, ByVal x As Long, ByVal y As Long, ByVal Width As Long, ByVal Height As Long) As Long
Private Declare Function XC_CopyFrameBuffer Lib "xcamera" (ByVal handle As Long, ByVal bufferhandle As Long, ByVal size As Long) As Long


' Some useful constants
Private CAM_Handle As Long
Public Const CAM_WIDTH = 320
Public Const CAM_HEIGHT = 256
Private Const NUM_ELEMENTS = 81920
Private Const FRAME_BUFFER_SIZE = 163840
Private CamResult As Long
Public FrameBuffer(1 To NUM_ELEMENTS) As Integer

Public Sub CAM_CaptureSingleFrame()
' Capture one frame
CamResult = XC_CaptureImage(CAM_Handle)
' Display in PictureBox control
CamResult = XC_Blit(CAM_Handle, pictLiveImage.hWnd, 0, 0, CAM_WIDTH, CAM_HEIGHT)   'Data Xfer is successful

' Note: for the Blit, the C++ 'void * where' was declared in VB as 'ByVal windowhandle As Long'
' with an actual calling argument value of 'pictLiveImage.hWnd'    it works...

' Attempts at Xfer to memory
' Compile Errors:
' ByRef declaration of bufferhandle in Function Declaration
CamResult = XC_CopyFrameBuffer(CAM_Handle, FrameBuffer, FRAME_BUFFER_SIZE)    'ByRef Argument Type Mismatch
CamResult = XC_CopyFrameBuffer(CAM_Handle, FrameBuffer(1), FRAME_BUFFER_SIZE) 'ByRef Argument Type Mismatch

' ByVal declaration of bufferhandle in Function Declaration
CamResult = XC_CopyFrameBuffer(CAM_Handle, FrameBuffer, FRAME_BUFFER_SIZE)    'Type Mismatch

' Compiles but executes without data Xfer
CamResult = XC_CopyFrameBuffer(CAM_Handle, FrameBuffer(1), FRAME_BUFFER_SIZE) 'Compiles but no data Xfer

End Sub

