PXD Family

Datasheet (PDF)

Manual & Guide

Application Notes

Driver Updates

Example Source Code

Compatible Image Processing Software

Product FAQ

Home Page


Feedback at:
CSinfo@cyberoptics.com or
1-800-366-9131

PXDBASIC Sample Program
Win32 Systems (Win95, 98, Me, NT, and 2000)

This sample program shows you how to build a Visual Basic program for the PXD1000 frame grabber.

Visual Basic Interface Information

When we released the PXD1000 we did not have support for Visual Basic, so there is no mention of it in our manual. However, all but one of the functions described in the manual can also be used with Visual Basic. Therefore you should use the manual as a guide when building Visual Basic programs. The manual explains all of the functions and all of the parameters that need to be passed to each one. The function that will NOT work with Visual Basic is identified and explained at the bottom of this page. In order to use Visual Basic with the PXD, you need two interface files that describe the functionality of the two DLLs you will use:

PXD_V6.BAS describes the functionality of the PXD_32.DLL, and
FRAME_V6.BAS describes the functionality of the FRAME_32.DLL.

You need to make both of the above BAS files part of your project.

The VIDEO_32.DLL

There is a third DLL and corresponding description file:

VIDEO_32.BAS describes the functionality of the VIDEO_32.DLL.

The Video_32.dll is not required, but it is useful for displaying video. Visual Basic does not provide a direct method for displaying video in a window. You can do it by including the Windows API functions in your project, but it is a bit messy. Therefore we have provided a DLL with only two functions to simplify the process for you. The two functions are described as follows:

pxSetWindowSize (x, y, dx, dy)
You call pxSetWindowSize once during initialization or any time you choose to change the window size. pxSetWindowSize tells the DLL the size of your target window in pixels. x and y should always be 0, dx and dy are the width and height of the target window respectively.

pxPaintDisplay (hDC, frm, x, y, dx, dy)
pxPaintDisplay moves the video from a buffer to the window specified by the hDC (Device Context handle). The parameters x, y, dx, dy specify the size of your buffer not the target window. If you want to display the entire buffer, then x and y are always 0. dx and dy are the width and height respectively of the buffer. The Video_32.dll uses StretchDIBits to achieve display, therefore it will be a bit slower than our samples that are written in C.

PXDBASIC consists of the following files:

CONTROL.FRM: Main control form
DISPLAY.FRM: Display form
FRMBMP.FRM: Special form for reading BMP files
GLOBAL.BAS: Declarations for global variables
VIDEO_32.BAS: Declarations Video Display DLL
FRAME_V6.BAS: Declarations for Frame library
PXD_V6.BAS: Declarations for PXD series functions

When you run PXDBASIC, you will need the following 3 DLLs in your path:

FRAME_32.DLL
PXD_32.DLL
VIDEO_32.DLL

To put the DLLs in your path, you have 3 options:

  1. Put the DLLs in the directory with the sample.
  2. Put the DLLs in the Windows\System directory.
  3. Modify your PATH variable to point to the directory where the DLLs are located.

PXD functions that will NOT work with Visual Basic


GetInterface

The GetInterface() function does not translate to Visual Basic because it returns a pointer to a structure that contains string pointers. If it were not for the string pointers we could make it work in VB. Strings are handled differently in C and in VB. There is no way to make it work. Typically, this function is not needed. It would only be used if you were going to build a CAM file from within your program. You can build those files with ConfigPXD.