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

C / C++ / MFC

 
GeneralRe: Time limited Demo Pin
RaymondM12-Jun-08 0:02
RaymondM12-Jun-08 0:02 
GeneralRe: Time limited Demo Pin
Graham Shanks12-Jun-08 0:13
Graham Shanks12-Jun-08 0:13 
GeneralRe: Time limited Demo Pin
Graham Shanks12-Jun-08 0:18
Graham Shanks12-Jun-08 0:18 
GeneralRe: Time limited Demo Pin
RaymondM12-Jun-08 1:08
RaymondM12-Jun-08 1:08 
QuestionIs there any API to change the owner of a certain window at runtime? Pin
Joseph Marzbani10-Jun-08 8:30
Joseph Marzbani10-Jun-08 8:30 
AnswerRe: Is there any API to change the owner of a certain window at runtime? Pin
«_Superman_»10-Jun-08 13:07
professional«_Superman_»10-Jun-08 13:07 
AnswerRe: Is there any API to change the owner of a certain window at runtime? Pin
Naveen10-Jun-08 14:32
Naveen10-Jun-08 14:32 
QuestionConvert from TCHAR* to char* Pin
x87Bliss10-Jun-08 8:21
x87Bliss10-Jun-08 8:21 
I am writing an application that communicates with an external device. I need to copy a CString (TCHAR*) to a multibyte string buffer (char*) - the catch is I need the code to be able to compile with UNICODE on or off. Basically I need a function that can copy either a WCHAR* or char* to a char*.

Currently I have:
CString szVal = _T("Some User Input String"); // i.e. not always the same value
char* Buf;
size_t BufLen;
#ifdef UNICODE
wcstombs_s(&szBufLen, NULL, NULL, szVal, _TRUNCATE); // get the req'd length including NULL
szBuf = new char[szBufLen];
wcstombs_s(&szBufLen, szBuf, szBufLen, szVal, _TRUNCATE); // convert and copy
#else
szBuf = new char[szVal.GetLength() + 1];
strcpy(szBuf, szVal);
#endif
// more code
delete [] szBuf;


The above works, but I would prefer not having to use the preprocessor directives if posssible.
The function _tcscpy will not convert from WCHAR to char when needed. I know I can easily write my own overloaded function, but I was hoping there was already a function defined.
AnswerRe: Convert from TCHAR* to char* Pin
led mike10-Jun-08 8:34
led mike10-Jun-08 8:34 
GeneralRe: Convert from TCHAR* to char* Pin
x87Bliss10-Jun-08 11:50
x87Bliss10-Jun-08 11:50 
AnswerRe: Convert from TCHAR* to char* Pin
Jijo.Raj10-Jun-08 9:11
Jijo.Raj10-Jun-08 9:11 
QuestionSet a "Title" and "Icon" for a certain window in taskbar ! [modified] Pin
Joseph Marzbani10-Jun-08 8:17
Joseph Marzbani10-Jun-08 8:17 
AnswerRe: Set a "Title" and "Icon" for a certain window in taskbar ! Pin
Jagdish V. Bhimbha10-Jun-08 22:49
Jagdish V. Bhimbha10-Jun-08 22:49 
QuestionHook ? Pin
york52810-Jun-08 6:00
york52810-Jun-08 6:00 
AnswerRe: Hook ? Pin
Joe Woodbury10-Jun-08 6:11
professionalJoe Woodbury10-Jun-08 6:11 
GeneralRe: Hook ? Pin
york52810-Jun-08 6:50
york52810-Jun-08 6:50 
GeneralRe: Hook ? Pin
Joe Woodbury10-Jun-08 8:15
professionalJoe Woodbury10-Jun-08 8:15 
AnswerRe: Hook ? Pin
Jijo.Raj10-Jun-08 6:45
Jijo.Raj10-Jun-08 6:45 
GeneralRe: Hook ? Pin
york52810-Jun-08 7:16
york52810-Jun-08 7:16 
AnswerRe: Hook ? Pin
Hamid_RT10-Jun-08 19:39
Hamid_RT10-Jun-08 19:39 
GeneralRe: Hook ? Pin
york52810-Jun-08 23:49
york52810-Jun-08 23:49 
GeneralRe: Hook ? Pin
Hamid_RT11-Jun-08 1:15
Hamid_RT11-Jun-08 1:15 
GeneralRe: Hook ? Pin
york52811-Jun-08 4:22
york52811-Jun-08 4:22 
GeneralRe: Hook ? Pin
Hamid_RT11-Jun-08 5:44
Hamid_RT11-Jun-08 5:44 
GeneralRe: Hook ? Pin
york52811-Jun-08 6:51
york52811-Jun-08 6:51 

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.