PXC 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

PXCDRAW Samples for Win32 Systems

Win32 Systems (Win95, 98, Me, NT, 2000 and XP)

The PXCDRAW samples are two programs that use the same GDI mechanism for displaying video in a window. The differences between the programs is in their use of the queuing facility in the PXC library. See the program 
descriptions below. You should feel free to use our samples as starting points for your applications. 

These programs are updates of the same programs that came on the floppies with your PXC product. 

The GDI Method 
These programs show you how to use the Windows GDI facilities to display video in a window. As computers become faster and faster, this becomes a very good way to display video. It is much simpler than DirectDraw and does 
not rely as heavily on the VGA drivers. 

Windows provides three methods for drawing graphics on a window: text, raster, and vector. These samples use the raster method. An image is stored in an array called a bitmap and then a call is made to a Windows function that 
describes how to display the bitmap. A bitmap consists of a header and an upside-down representation of an image. 

In the following programs, we set the header with the function SetBitMapHead(). We flip the image upside down with the function GetImage(). And we send the image to the screen with the Windows function SetDIBitsToDevice(). You can also use StretchDIBits() but it is slower. Don't use StretchDIBits unless the image and window are different sizes. SetDIBitsToDevice() is the fastest way to move an image to the VGA card when the image size does not need to 

The complete algorithm for grabbing and displaying an image is as follows: 

The bitmap header is set during initialization and never changed. After the grab, the image is flipped row by row in GetImage() and displayed. The work is divided between the functions AppPaint() and AppIdle(). 

Unzipping the Programs
The programs will unzip into two directories under C:\PXC2\SAMPLES. If you used the default C:\PXC2 when you ran our setup program, then the samples will compile right where they unzip. If you changed the default, then you will
have to modify the project file.

These two programs have project files for Microsoft Visual C/C++ 6.0. If you have an older version or a different compiler, you will need to make your own project file.

The only thing you need in your project file is the source (PXCDRAW1.C or PXCDRAW2.C), the header PXC.H and a reference to the library ILIB_32.LIB for Microsoft or ILIB_32B.LIB for Borland.

If you prefer to use the command line compiler, there are two make files included with the programs.

Notes on Compilers 
In order to make compiling and linking easier, you can add our LIB and INCLUDE directories to the directories that your compiler and linker normally search. Our libraries are not installed in your compiler's LIB directory. You must explicitly link your program with any third party library like ours. 

Borland compilers and linkers use the TURBOC.CFG file to locate libraries and header files. The TURBOC.CFG file can be found in your compiler's BIN subdirectory. For example, if you have the Borland 5.0 compiler, the TURBOC.CFG file will be found in 


It normally contains the following two lines: 

You can modify it to include the PX5 subdirectories as follows: 

You need to use Microsoft C/C++ 4.0 or newer to link with our import library. Microsoft compilers use environment variables to find LIB and INCLUDE directories. You can add the PXC2 directories to the existing values. These variables are typically set in your AUTOEXEC.BAT file or in the System Applet in NT. 


If you are using a Windows IDE with either Borland or Microsoft, you can set these same values as defaults in the IDE, or you can include the libraries as part of your project file. 

The PXCDRAW Sample Programs

This is the simplest and slowest sample. It uses a NON-QUEUED grab which means it wastes 33 ms waiting for the grab to complete. Then it flips the image and copies it to a window. This sample has a maximum theoretical speed 
of 20 frames a second if it can get the display done in 1 field time (16 ms). That means it would grab a frame, skip a field, grab a frame, etc. 

When you run the program, make note of the COMPOSITE and SVIDEO buttons. Make sure you press the button for the type of video you have.

For the PXC200-L, s-video must be on channel 1 of the channels 0 thru 3.
For the PXC200-F, s-video can be on any or all channels.

This sample uses QUEUED frame grabs and DOUBLE BUFFERING. It keeps the image buffers full by using 2 queued grabs. It flips an image and requeues the next grab while it sends the image to a window. If this sample can flip an image and requeue the next one fast enough, it can achieve a speed of 30 frames per second. On most newer computers, this sample should display 25 (CCIR) or 30 (NTSC) fps. In the early days of Pentiums that was not true, but today with speeds between 400 and 700 MHz it should be quite easy to reach real time display. 

Both sample progams use 24 bit RGB images by default.  This means that they will run better if the computer's display adapter is in 24 bit color mode (sometimes called True Color or 16 million color mode).  The samples can
be recompiled to use 8 bit grayscale images by changing the value of the PIXEL_TYPE constant near the top of the source file.  Note that the programs will only work with 8 or 24 bit frames.