Hi All,
I created a dialog (which has Edit Control) on it in Win 32. I derived the dialog from CDialogImpl class.
I am facing a problem in entering Unicode characters on the Edit box control.
In designer, when i enter characters in Unicode (say Hindi Language), it is showing correctly.
But when i run the program, the same edit box shows "?".
The code for the Dialog Box looks something like below :
The Header (.h) file :
#pragma once
#include "resource.h"
class CEnterPasswordDlg : public CDialogImpl<CEnterPasswordDlg>
{
public:
CEnterPasswordDlg(); virtual ~CEnterPasswordDlg();
enum { IDD = IDD_DIALOG_ENTER_PASSWORD };
WTL::CString GetEnteredPassword() { return m_strPasswordEntered; };
LRESULT OnCloseCmd(WORD , WORD wID, HWND , BOOL& );
LRESULT OnCancelCmd(WORD , WORD wID, HWND , BOOL& );
LRESULT OnInitDialog(UINT , WPARAM , LPARAM , BOOL& );
protected:
BEGIN_MSG_MAP(CEnterPasswordDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCancelCmd)
END_MSG_MAP()
private:
WTL::CString m_strPasswordEntered;
};
The Implementation File (CPP File) :
#include "stdafx.h"
#include "EnterPasswordDlg.h"
CEnterPasswordDlg::CEnterPasswordDlg()
: m_strPasswordEntered(_T(""))
{
}
CEnterPasswordDlg::~CEnterPasswordDlg()
{
}
LRESULT CEnterPasswordDlg::OnCloseCmd(WORD , WORD wID, HWND , BOOL& )
{
char cPassword[MAX_PATH];
GetDlgItemText(IDC_EDIT_PASSWORD, cPassword, MAX_PATH);
m_strPasswordEntered = cPassword;
EndDialog(wID);
return 0;
}
LRESULT CEnterPasswordDlg::OnCancelCmd(WORD , WORD wID, HWND , BOOL& )
{
EndDialog(wID);
return 0;
}
LRESULT CEnterPasswordDlg::OnInitDialog(UINT , WPARAM , LPARAM , BOOL& )
{
CenterWindow();
return TRUE;
}
Could anyone tell me what could be wrong ?
How can i see the Unicode characters that i actually enter in the dialog.
My project is not an Unicode project. I didn't add the Macro "_UNICODE".
Is it possible without adding that Macro to the project properties ?
It is fine for me if i could just add Unicode properties to this dialog alone.
Any help will be greatly appreciated
Thanks and Regards,
Kishor Reddy