2012年12月28日 星期五

How to create CMFCPropertySheet


1. First, "Project" -> "Class Wizard.."->"Add Class" --> Select "CPropertyPage".  If you select "CMFCPropertyPage", it will get error, when you run it.
2.After class was created,  we replace all "CPropertyPage" by "CMFCPropertyPage".
3. Add CMFCPropertySheet class.  And add the code.
CMySheet.h
public:
CMySheet();
virtual ~CMySheet();
CMyPage m_page1;
CMySheet.cpp
CMySheet::CMySheet()
{
AddPage(&m_page1);
}
4.
        //Cf9Dlg dlg;
CMySheet dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();

-----------------------
1. The first step, we can check http://msdn.microsoft.com/en-us/library/bb981937.aspx about the MSDN CMFCCpropertySheet Class information (Remarks).

2. We can try to find the information in the http://support.microsoft.com/kb/325613/en-us to know how to add the CPropertySheet and CPropertyPage.

3. There is the http://blog.163.com/xu_chao2000/blog/static/277706102010430338431/ for the CMFCPropertySheet and CMFCPropertyPage.  You will need to create new DIALOG resource to add "CPropertyPage" base class, because the Visual studio has the problem to use "CMFCPropertyPage" as the base class.  After add OK, then change it to "CMFCPropertyPage".

4. More information about CMFCPropertySheet -- http://blog.csdn.net/tory75034/article/details/5404061


2012年12月26日 星期三

About National Language Support

The msdn document http://msdn.microsoft.com/en-us/library/dd317708(v=vs.85).aspx .


The National Language Support (NLS) functions permit applications to:
  • Set the locale for the user
  • Identify the language in which the user works
  • Retrieve strings representing times, dates, and other information formatted correctly for the specified language and locale

There is also the http://stackoverflow.com/questions/953416/find-out-the-language-windows-was-installed-as talk about this.  Two ways to get the OS installed language
1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language\InstallLanguage which returns a four digit language code.
2. The Win32 function is GetSystemDefaultUILanguage() http://msdn.microsoft.com/en-us/library/dd318123(VS.85).aspx.

1. Locale IDs, Input Locales, and Language Collections for Windows XP and Windows Server 2003.
http://msdn.microsoft.com/en-us/goglobal/bb895996.aspx.  

2. Re: How to translate the LANGID into strings. http://www.tech-archive.net/Archive/VisualStudio/microsoft.public.vstudio.general/2004-08/0250.html

 TCHAR szName[100]; 
        if ( 0 != GetLocaleInfo( MAKELCID( MAKELANGID( 0x411, 0 ),
SORT_DEFAULT ),
                LOCALE_SENGLANGUAGE,
                szName, 100 ) )
        {
                printf( szName );
        }