<< Back

C++ and MFC Sample

The C++ sample program is intended to cover all of the functionality of the FTP Voyager SDK. Because it's so comprehensive, it can also be overwhelming. After mastering the C samples, move on to the this sample to fully understand the FTP Voyager SDK API.

You are free to use this program and its source as needed for your implementation as long as the FTP Voyager Software Development Kit license agreement is followed. You are not allowed to distribute the C++ sample program as it is here. You must rename it, change the user interface, change all the graphics, and make it your own. Please be aware that the FTP Voyager SDK license agreement prohibits using this SDK to create a program that competes with FTP Voyager directly or indirectly.

The Sample C++ program was written using Microsoft Developer Studio 2005. Conversion to Microsoft Developer Studio 2003 or 6.0 should be relatively easy, as should conversion to future versions.

As with FtpTree ActiveX Control and the FTP Voyager SDK, the C++ sample program is written using the Microsoft Foundation Class library (MFC). You are not required to use MFC in your application, however the MFC and Microsoft Visual C++ runtime libraries must be distributed with your application, as outlined here.

.CPP Source Files

The C++ sample program is a typical MFC dialog based program. The following list briefly describes each of the .CPP files contained in the project.

SampleCPP.cpp The "main" program (theApp) that loads the dialog (CSampleCPPDlg) then returns.
SampleCPPDlg.cpp Implementation of the C++ Sample's dialog. This is where most of the interfacing to the FTP Voyager SDK occurs.
GetFileNameDlg.cpp Dialog box used to ask the user for a file name or directory path. This dialog is used for both remote and local paths, and does no error checking.
GetCommandDlg.cpp Dialog box used to ask the user for an FTP command to send to the server.
FVSDKLogList.cpp MFC derived class for the Windows Rich Edit Control. This class shows the log information inside the CSampleCPPDlg.

Coding Style

The coding style used by the FTP Voyager SDK and the C / C++ sample attempts to place meaningful comments on every line of logic. Tab stops should be set to 4 characters. Brackets are always placed on the line with the conditional operation and the closing bracket always identifies what's being closed. Additionally, the MFC style "Hungarian" naming convention is used to help identify the member types.

Of course, your applications don't need to follow this style, however we are mentioning our style here so that in case you've never seen it before you're aware. In addition, if your tab stops are not set to 4, columns and indentations will not align correctly.

User Input

Because this is a sample program focusing on the FTP Voyager SDK, instead of good user interface practices, this sample program uses a very basic input method that simply asks for a string from the user where required. When prompted, the user must know whether or not the requested information is a full path, a directory, a remote path, or a local path. Because of this you, as the user, must identify if forward or backward slashes should be used as directory separators. Very little intelligent error handling is present in this sample application beyond checking for and identifying error conditions.

Sample Installation Script

To help with deployment, a sample InnoSetup installation script is included. Click here for more information about deploying the FTP Voyager SDK in your application.