|
// ApplicationDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Application.h"
#include "ApplicationDlg.h"
#include <direct.h> // For getting path to current folder
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CApplicationDlg dialog
CApplicationDlg::CApplicationDlg(CWnd* pParent /*=NULL*/)
: CDialog(CApplicationDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
//=====================================================================
CApplicationDlg::~CApplicationDlg()
{
// Release the language
m_pLanguage->ReleaseLanguage();
}
//=====================================================================
void CApplicationDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, lblExample, m_lblExample);
}
//=====================================================================
BEGIN_MESSAGE_MAP(CApplicationDlg, CDialog)
ON_BN_CLICKED(btnLoadLanguage, OnBtnLoadLanguage)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CApplicationDlg message handlers
BOOL CApplicationDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Init language object
m_pLanguage = CLanguage::Instance();
// Init language folder and default language
m_pLanguage->Init("lng", "enlgish");
// Load default system language
m_pLanguage->LoadLanguage(GetSystemDefaultLangID());
// Call the function that is responsible for translating all controls
TranslateAllControls();
return TRUE; // return TRUE unless you set the focus to a control
}
//=====================================================================
void CApplicationDlg::OnBtnLoadLanguage()
{
// Declare variables
string sDLLPath;
char map[_MAX_PATH];
// Get working path
_getcwd(map, _MAX_PATH);
sDLLPath = map;
// Set up dll path
sDLLPath += "\\lng\\dutch.dll";
// Load the dutch example language
m_pLanguage->LoadLanguage(sDLLPath, "Dutch");
// Call the function that is responsible for translating all controls
TranslateAllControls();
}
//=====================================================================
void CApplicationDlg::TranslateAllControls()
{
// Load all strings for controls
m_lblExample.SetWindowText(m_pLanguage->GetString(IDS_EXAMPLE).c_str());
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.