Click here to Skip to main content
16,015,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionUpper to lower case conversion in Russian language???????? Pin
sumit.durg23-May-08 2:42
sumit.durg23-May-08 2:42 
AnswerREPOST! PLEASE IGNORE Pin
Rajesh R Subramanian23-May-08 2:59
professionalRajesh R Subramanian23-May-08 2:59 
AnswerRe: Upper to lower case conversion in Russian language???????? PinPopular
Hamid_RT23-May-08 5:30
Hamid_RT23-May-08 5:30 
QuestionHow can I convert LPCTSTR to CString ? Pin
SherTeks23-May-08 2:33
SherTeks23-May-08 2:33 
AnswerRe: How can I convert LPCTSTR to CString ? Pin
Cedric Moonen23-May-08 2:38
Cedric Moonen23-May-08 2:38 
GeneralRe: How can I convert LPCTSTR to CString ? Pin
SherTeks23-May-08 18:07
SherTeks23-May-08 18:07 
AnswerRe: How can I convert LPCTSTR to CString ? Pin
SherTeks23-May-08 18:47
SherTeks23-May-08 18:47 
GeneralRe: How can I convert LPCTSTR to CString ? Pin
Jijo.Raj24-May-08 1:21
Jijo.Raj24-May-08 1:21 
SherTeks wrote:
I found that the pointer to 'infoBuf' was getting lost as soon as the 'GetTheComputerName()'
returned.


Because in the CSample1Dlg::GetTheComputerName() you are returning the stack variable - infoBuf. The stack variables will get deleted when the function returns.


SherTeks wrote:
There are 2 ways to resolve this :

1) Declare TCHAR infoBuf[MAX_COMPUTERNAME_LENGTH + 1]; in a .h file as a data member.
OR
2) Make 'infoBuf' as static if it is locally declared within 'GetTheComputerName()'


I can suggest another method. Pass a CString by reference to the function. Then inside the function, get the computer name and assign to CString param. For instance see the code snippet.

void CSample1Dlg::GetTheComputerName( CString& csComputerName )
{
    TCHAR infoBuf[MAX_COMPUTERNAME_LENGTH + 1];
    DWORD bufCharCount = MAX_COMPUTERNAME_LENGTH;
    
    GetComputerName( infoBuf, &bufCharCount );
    
    // Assign the computer name to csComputerName
    csComputerName = infoBuf;
}

...

// Call it like this
CString csComputerName;
GetTheComputerName( csComputerName );


________________________________

http://weseetips.com - Visual C++ technical tips.

GeneralRe: How can I convert LPCTSTR to CString ? Pin
SherTeks25-May-08 18:16
SherTeks25-May-08 18:16 
QuestionEdit box cursor control ? Pin
Vaclav_23-May-08 1:24
Vaclav_23-May-08 1:24 
AnswerRe: Edit box cursor control ? [modified] Pin
Rajkumar R23-May-08 2:02
Rajkumar R23-May-08 2:02 
GeneralSOLVED Re: Edit box cursor control ? Pin
Vaclav_23-May-08 4:47
Vaclav_23-May-08 4:47 
GeneralRe: SOLVED Re: Edit box cursor control ? Pin
Rajkumar R23-May-08 6:08
Rajkumar R23-May-08 6:08 
GeneralRe: SOLVED Re: Edit box cursor control ? Pin
Vaclav_23-May-08 7:16
Vaclav_23-May-08 7:16 
QuestionRe: SOLVED Re: Edit box cursor control ? Pin
Rajkumar R24-May-08 3:05
Rajkumar R24-May-08 3:05 
AnswerRe: SOLVED Re: Edit box cursor control ? Pin
Vaclav_24-May-08 4:18
Vaclav_24-May-08 4:18 
QuestionHow to conversion from upper case string to lower case in MFC. Pin
sumit.durg23-May-08 0:05
sumit.durg23-May-08 0:05 
AnswerRe: How to conversion from upper case string to lower case in MFC. Pin
toxcct23-May-08 0:13
toxcct23-May-08 0:13 
AnswerRe: How to conversion from upper case string to lower case in MFC. Pin
Rajesh R Subramanian23-May-08 0:25
professionalRajesh R Subramanian23-May-08 0:25 
QuestionRe: How to conversion from upper case string to lower case in MFC. Pin
Nelek23-May-08 1:22
protectorNelek23-May-08 1:22 
QuestionRe: How to conversion from upper case string to lower case in MFC. Pin
Maxim Zarus23-May-08 1:32
Maxim Zarus23-May-08 1:32 
AnswerRe: How to conversion from upper case string to lower case in MFC. Pin
Rajesh R Subramanian23-May-08 1:33
professionalRajesh R Subramanian23-May-08 1:33 
GeneralRe: How to conversion from upper case string to lower case in MFC. Pin
Nelek23-May-08 1:59
protectorNelek23-May-08 1:59 
GeneralRe: How to conversion from upper case string to lower case in MFC. Pin
Rajesh R Subramanian23-May-08 2:05
professionalRajesh R Subramanian23-May-08 2:05 
AnswerRe: How to conversion from upper case string to lower case in MFC. Pin
sumit.durg23-May-08 1:59
sumit.durg23-May-08 1:59 

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.