We will now compile this program using Microsoft Visual C++ version 6. See the article  How To Compile An Extension Using Microsoft Visual Studio 2005 for a description of how to use that compiler. Other compilers should work similarly, but we are unable to provide technical support on further compilers.

Open Visual C++, and click on File...New:



Select "Win32 Application" from the Projects list, and give your project a name: I used "Hello World". The press OK, and select to create an empty project:



Then switch the Project Explorer to FileView, right-mouse-click on Source Files and choose Add Files to Folder...


Add the files hello world.c and zclient.c to the project. Hello World.c can be downloaded from the last page of this article, and zclient.c is in {zemaxroot}/Extend.


To compile the program, click Build -> Build Hello World.exe. It should compile with no errors or warnings.


Make sure ZEMAX is running, and that Extensions are allowed to push lenses (see the first page of this article). Load the sample file {zemaxroot}/samples/sequential/objectives/Cooke 40 degrees field.zmx. You will find the compiled hello world.exe in the project folder, and it can be run simply by double-clicking it (or by pressing cntl-F5 within Visual C++). You should see the following message boxes appear:







Congratulations! Your extension is talking to ZEMAX!