Click here to Skip to main content
16,004,678 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCan a function call a afx_msg function??? [modified] Pin
mimimimilaw13-Aug-06 17:33
mimimimilaw13-Aug-06 17:33 
AnswerRe: Can a function call a afx_msg function??? Pin
Hamid_RT13-Aug-06 19:33
Hamid_RT13-Aug-06 19:33 
GeneralRe: Can a function call a afx_msg function??? Pin
mimimimilaw13-Aug-06 20:18
mimimimilaw13-Aug-06 20:18 
GeneralRe: Can a function call a afx_msg function??? Pin
Hamid_RT13-Aug-06 21:26
Hamid_RT13-Aug-06 21:26 
AnswerRe: Can a function call a afx_msg function??? Pin
prasad_som13-Aug-06 19:37
prasad_som13-Aug-06 19:37 
QuestionCan't Minimize windows Pin
Max++13-Aug-06 14:59
Max++13-Aug-06 14:59 
AnswerRe: Can't Minimize windows Pin
Waldermort13-Aug-06 15:04
Waldermort13-Aug-06 15:04 
Questionversioninfo problems Pin
Waldermort13-Aug-06 10:29
Waldermort13-Aug-06 10:29 
I am displaying some of the version info in an 'about' box within my app. The problem is, after reading Chinese text from the version info it kinda screws up following calls to LoadString(). I have narrowed the problem down to a single call to VerQueryValue(). This function does as it should, it reads the string from the version info and returns it. But for some reason, When calling LoadString with a resource id of IDS_13 (8 Chinese characters Shown below), instead of returning the null terminated string, it fills the provided buffer with all the strings from IDS_14 and up. If LoadString is called with an id of higher than IDS_13 the app crashes.

LPSTR GetVersionInfo(LPCTSTR csEntry)
{
    LPSTR csRet = NULL;
  
    HRSRC hVersion = FindResource( hGlobLang, 
        MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION );
    if (hVersion != NULL)
    {
        HGLOBAL hGlobal = LoadResource( hGlobLang, hVersion ); 
        if ( hGlobal != NULL)  
        {  
            LPVOID versionInfo = LockResource(hGlobal);  
            if (versionInfo != NULL)
            {
                DWORD vLen,langD;
                BOOL retVal;    
                LPVOID retbuf=NULL;
                char fileEntry[256];

                sprintf(fileEntry,"\\VarFileInfo\\Translation");
                retVal = VerQueryValue(versionInfo,fileEntry,&retbuf,(UINT *)&vLen);
                if (retVal && vLen==4) 
                {
                    memcpy(&langD,retbuf,4);            
                    sprintf(fileEntry, "\\StringFileInfo\\%02X%02X%02X%02X\\%s",
                        (langD & 0xff00)>>8,langD & 0xff,(langD & 0xff000000)>>24,
                        (langD & 0xff0000)>>16, csEntry);            
                }
                else 
                    sprintf(fileEntry, "\\StringFileInfo\\%04X04B0\\%s",GetUserDefaultLangID(), csEntry);

                // The following function seems to be the cause
                if (VerQueryValue(versionInfo,fileEntry,&retbuf,(UINT *)&vLen))
                    csRet = (char*)retbuf;	
            }
        }

        UnlockResource( hGlobal );  
        FreeResource( hGlobal );  
    }
    return csRet;
}

BOOL CALLBACK AboutProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
    static char Version[20],Date[40];
    if (Message == WM_INITDIALOG) 
    {
        char *tmp = LStr(IDS_14); // LoadString function
        tmp = GetVersionInfo("SpecialBuild");
        tmp = LStr(IDS_14);

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_01                  "ÃÜÂë´íÎó"
    IDS_02                  "´íÎóÓû§Ãû"
    IDS_03                  "Unkown Pending command"
    IDS_04                  "´ò¿ª"
    IDS_05                  "Excel Îĵµ (*.xls)\0*.xls\0\0"
    IDS_06                  "ѧÉúÊý¾Ý (*.sd)\0*.sd\0ËùÓÐÎĵµ (*.*)\0*.*\0\0"
    IDS_07                  "ѧÉúÊý¾Ý (*.sd)\0*.sd\0Excel Îĵµ (*.xls)\0*.xls\0ËùÓÐÎĵµ (*.*)\0*.*\0\0"
    IDS_08                  "ѧÉúÊý¾Ý¿â (*.sd)\0*.sd\0"
    IDS_09                  "¾¯¸æ"
    IDS_10                  "ÄãÏë±£´æÒѾ­Ð޸ĵÄÉèÖÃÂð?"
    IDS_11                  "ID ´íÎó'input_comment'"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_12                  "ûÓпÉÓõļͼ"
    IDS_13                  "ÎÞ·¨»ñµÃѧÉú¼Í¼"
    IDS_14                  "ÎÞ·¨ÏÂÔØ 'Rich Edit' ¿ØÖÆ!"
    IDS_15                  "ÕýÔÚ×¼±¸..."

QuestionHow to change window RTL in RUNTIME? Pin
Kamyar Souri13-Aug-06 7:21
Kamyar Souri13-Aug-06 7:21 
QuestionLNK2005 error - first program with classes Pin
senthryl13-Aug-06 4:21
senthryl13-Aug-06 4:21 
AnswerRe: LNK2005 error - first program with classes Pin
Chris Losinger13-Aug-06 4:45
professionalChris Losinger13-Aug-06 4:45 
GeneralRe: LNK2005 error - first program with classes Pin
senthryl13-Aug-06 5:07
senthryl13-Aug-06 5:07 
GeneralRe: LNK2005 error - first program with classes [modified] Pin
Chris Losinger13-Aug-06 5:14
professionalChris Losinger13-Aug-06 5:14 
GeneralRe: LNK2005 error - first program with classes [modified] Pin
senthryl13-Aug-06 5:20
senthryl13-Aug-06 5:20 
GeneralRe: LNK2005 error - first program with classes Pin
Chris Losinger13-Aug-06 5:31
professionalChris Losinger13-Aug-06 5:31 
GeneralRe: LNK2005 error - first program with classes Pin
senthryl13-Aug-06 5:44
senthryl13-Aug-06 5:44 
GeneralRe: LNK2005 error - first program with classes Pin
Chris Losinger13-Aug-06 8:41
professionalChris Losinger13-Aug-06 8:41 
GeneralRe: LNK2005 error - first program with classes Pin
Mike Dimmick13-Aug-06 5:28
Mike Dimmick13-Aug-06 5:28 
QuestionGetting friend member functions to work Pin
Joel Becker13-Aug-06 2:11
Joel Becker13-Aug-06 2:11 
AnswerRe: Getting friend member functions to work Pin
Mike Dimmick13-Aug-06 5:30
Mike Dimmick13-Aug-06 5:30 
GeneralRe: Getting friend member functions to work Pin
Joel Becker13-Aug-06 7:13
Joel Becker13-Aug-06 7:13 
AnswerRe: Getting friend member functions to work Pin
Bartosz Bien13-Aug-06 11:11
Bartosz Bien13-Aug-06 11:11 
GeneralRe: Getting friend member functions to work Pin
Joel Becker13-Aug-06 11:22
Joel Becker13-Aug-06 11:22 
GeneralRe: Getting friend member functions to work [modified] Pin
Bartosz Bien13-Aug-06 11:47
Bartosz Bien13-Aug-06 11:47 
GeneralRe: Getting friend member functions to work Pin
Joel Becker13-Aug-06 12:22
Joel Becker13-Aug-06 12:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.