Interfacing computers to physics experiments
This page is for the new ExpEYES (ExpEYES Junior)
For the old ExpEYES click here

Three completely different scenarios are available for code development in MsWindows: Win32API, MFC and Windows Forms. Unfortunately on the web and in books, a clear demarkation is often not made. You may find code snippets, comments and discussion without a mention of which of the three different programming paradigms it is relevant for.

Win32API: This is also called native Windows programming. Win32API is the Applications Progamming Interface for Windows. All programs running under Microsoft's operating system (Windows XP, Vista, Windows 7 and up) actually endup interacting with the API. The API is designed so that a C Language program can make calls to it for creating a window, drawing on it and other operating system interaction. You can think of Win32API as the lowest level. The other C/C++ programming methodoligies (MFC, Windows Forms and other languages such as C#) are actually wrappers around this. In Win32API programming we code directly with Win32API calls. The language used is C, not C++.

Microsoft Foundation Classes (MFC): The Win32API has over a thousand different C calls. As the emphasis in the programming world began to shift to object oriented programming, Microsoft provided a work-around with the help of a class library. A user program developed in Visual C++ would make use of this class library. This made it easier to develop codes. Many higher level functions were made available which encapsulated a large number of Win32API calls. While Win32API is free, MFC is available only in Microsoft Professional editions of VC++.

Many programmers are wedded to MFC and cannot imagine coding directly in Win32API. They would tell you that there are many features in MFC that are not available in the API. Actually, MFC just combines functions of the API. A Win32API program can deifinitely do everything an MFC program can, but a lot of user written code would sometimes be needed.

Windows Forms: This is the third programming paradigm, currently the most powerful in terms of ease of code developemnt. It has its flipside too as we shall see. The Graphical User Interface (GUI) can be developed rather rapidly by dragging elements from Visual Studio's Toolbox. The resulting code is generated as a .NET application which runs under the CLR/CLI.

CLR/CLI and .NET: Microsoft .NET is a software framework that includes a large library and provides language interoperability. Programs do not make calls directly but go through the safer route of the .NET framework which forwards calls to the API. In Win XP, .NET framework needs to be installed but it comes pre-installed in Windows 7. The Common Language Runtime/Common Language Infrastructure (CLR/CLI) refers to the virtual machine component of the .NET framework. So very often when we mention CLR/CLI or .NET we are referring to same thing.

So, MFC and Win32 Applications run directly under Windows while a Windows Forms Application runs inside the virtual machine.

Why develop a Win32 application?: When we have MFC and Windows Forms, why develop with Win32API direct calls? Some people are more comfortable with its greater simplicity and in that it does not involve any object oriented programming. At first it appears that the codes are bulky and take a lot of time to write. In practice, programmers simply paste fragments from their own code or from running examples available for each common GUI element. The parts of the code not connected with GUI elements are anyhow to be developed in the same way. MFC is not available in the free Express Editions of VC++. Speed and performance are the other reasons. A program making direct API calls runs in the fastest possible way.

After working your way through the tutorial for weyes, tackling any other project becomes easy. Almost all the common GUI elements are to be found: Picture Display, Check Buttons, Simple Buttons, Menu Strip, Trackers, Static Labels, Combo Boxes, Edit Boxes and drawing lines. Code snippets from here can be pasted into other projects. You will also find the use of timers, multi-process and multi-threaded programming.

Windows Forms Application: Development of WinEyes as a Windows Forms application is equally instructive. Given the ease of developing the GUI with the Visual Studio Toolbox, its probably a route many people will like. The major difficulty with Windows Forms, is that sometimes one gets completely stuck to find the right syntax. Many tasks that are easily carried out in normal ANSI C are not supported. Handling strings is done differenty. Constructs like global arrrays are not allowed. Intellisense does not aid in finding a new command. The help provided by Microsoft both offline and online are unfortunately not very useful. Example codes are often missing or provided only for languages other than C++. Search for a feature may take you very far away from the goal. There is no clear demarkation between what is meant for Win32API, MFC or Windows Forms. Only with a lot of patience the needed commands can eventually be discovered! Working with the code and tutorials presented here you will learn a host of features for the usual GUI elements and some more advanced topics including the built-in classes for multi-process and multi-threaded programming.


1.First you have to make sure that the USB driver needed for expEYES is installed. If you installed the python programs under windows (either from or the CD provided with the kit) then the driver will be already installed on your computer. Otherwise you should install it now.

2.You should have at least a rudimentry knowledge of the C or C++ programming languages.

3.If you are new to programming, you should first write a few simple programs of your own.

3 Programing Scenarios

Programming in Windows
Win-API, MFC and Win-Forms