// SampleCPP.cpp : Defines the class behaviors for the application.
//
// Copyright © 1997-2008 - Rhino Software, Inc.
// FTP Voyager® is a registered trademark of Rhino Software, Inc.
// http://www.RhinoSoft.com/
//
// Author: Mark P. Peterson
// Date: August 19, 2005
//
// You are free to use/modify this code but leave this header intact.
// This code is public domain so you are free to use it any of your
// applications (Freeware, Trialware, Commercial, etc.). FTP Voyager,
// the FTP Voyager Software Development Kit, and FtpTree ActiveX Control
// are not public domain. Any registration IDs or non-public domain software
// from Rhino Software, Inc. remains copyrighted. For more information
// refer to the license agreement distributed with the FTP Voyager SDK.
//
// If you decide to use the FTP Voyager Software Development Kit, or FtpTree
// ActiveX control, you must first purchase a license. For more information
// visit http://www.RhinoSoft.com/
//------------------------------------------------------------------------------
//
// NOTE: This FTP Voyager SDK sample is more complex than the C Sample found in
// C:\Program Files\RhinoSoft.com\FVSDK\SampleC
// The intent of this sample is to cover all of the FTP Voyager SDK's functionality
//
//------------------------------------------------------------------------------
#include "stdafx.h"
#include "SampleCPP.h"
#include "SampleCPPDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only CSampleCPPApp object
CSampleCPPApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CSampleCPPApp
BEGIN_MESSAGE_MAP(CSampleCPPApp, CWinApp)
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSampleCPPApp construction
CSampleCPPApp::CSampleCPPApp()
{
} // CSampleCPPApp
CSampleCPPApp::~CSampleCPPApp()
{
} // ~CSampleCPPApp
/////////////////////////////////////////////////////////////////////////////
// CSampleCPPApp initialization
BOOL CSampleCPPApp::InitInstance()
{
// initialize common controls
InitCommonControls();
// initialize the rich edit control use in a dialog
AfxInitRichEdit();
// call the base class function
CWinApp::InitInstance();
// change the registry key under which our settings are stored
SetRegistryKey(_T("Rhino Software"));
// do the dialog
CSampleCPPDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
// do not enter the message loop, exit
return (FALSE);
} // InitInstance
/////////////////////////////////////////////////////////////////////////////
// CSampleCPPApp version
const CString& CSampleCPPApp::GetVersionInfo()
{
// no version number yet?
if (m_sVersion.IsEmpty()) {
TCHAR pszBuff[_MAX_PATH];
DWORD dwVerHnd;
// default version number
m_sVersion = "N/A";
// get the module file name
VERIFY(::GetModuleFileName(m_hInstance, pszBuff, _MAX_PATH));
// get the file version info size
DWORD dwVerInfoSize = ::GetFileVersionInfoSize(pszBuff, &dwVerHnd);
// successful getting the size, get the version info
if (dwVerInfoSize) {
HANDLE hMem = GlobalAlloc( GMEM_MOVEABLE, dwVerInfoSize + 1);
LPSTR lpstrVffInfo = (char *) GlobalLock(hMem);
// get the version information
::GetFileVersionInfo((LPTSTR) pszBuff, dwVerHnd, dwVerInfoSize, (LPVOID) lpstrVffInfo);
DWORD dwVersionLen = 0;
LPSTR lpVersion = NULL;
// query the version info
BOOL bRetCode = ::VerQueryValue((LPVOID) lpstrVffInfo,
(LPSTR) "\\StringFileInfo\\040904e4\\FileVersion",
(void **) &lpVersion,
(UINT *) &dwVersionLen);
// get the version
if (bRetCode && dwVersionLen && lpVersion) {
m_sVersion = lpVersion;
m_sVersion.Replace(',', '.');
m_sVersion.Replace(" ", "");
#ifdef _DEBUG
m_sVersion += " - DEBUG";
#endif
} // if
// release allocated memory
GlobalUnlock(hMem);
GlobalFree(hMem);
} // if
} // if
// return the string containing the version info
return (m_sVersion);
} // GetVersionInfo