How to include ForexConnect API on Win32

Brief

The article discusses how to use ForexConnect API in C++ on Win32.

Details

To use ForexConnect API in your C++ application, you should:

  1. Place your application program in the same directory where supporting dlls are located (usually the bin folder containing expat.dll, fxmsg.dll, gstools2.dll, etc.)
    For example, if folder C:\Program Files\Candleworks\ForexConnectAPI\bin contains these libraries, post-built event command line can look like this:

    copy "C:\Program Files\Candleworks\ForexConnectAPI\bin\*.dll" "$(TargetDir)"

    Alternatively, you can build you application in the directory containing supporting dlls.

  2. Add the include subfolder of the directory where ForexConnect API is installed to additional include directories of the project. So if ForexConnect API is installed to C:\Program Files\Candleworks\ForexConnectAPI, add the directory C:\Program Files\Candleworks\ForexConnectAPI\include as additional include directory.

  3. Add lines:

    #include <windows.h> 
    #include "ForexConnect.h"

    to file stdafx.h.

  4. Add lib subfolder of the directory where ForexConnect API is installed to additional library directories of the project. So if ForexConnect API is installed to C:\Program Files\Candleworks\ForexConnectAPI, add the directory C:\Program Files\Candleworks\ForexConnectAPI\lib as additional library directory.
    Add ForexConnect.lib as additional dependency for the linker input.

Note: ForexConnect API interfaces uses ASCII strings so Character Set of Configuration Properties will be "Not set".

back