Click here to Skip to main content
15,915,094 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ATL with C code Pin
NiceNaidu15-Jun-06 21:47
NiceNaidu15-Jun-06 21:47 
GeneralRe: ATL with C code Pin
marcoslav15-Jun-06 23:41
marcoslav15-Jun-06 23:41 
Questionhow to Lock the screen when we shut the window? Pin
xuwenq8815-Jun-06 19:25
xuwenq8815-Jun-06 19:25 
AnswerRe: how to Lock the screen when we shut the window? Pin
Hamid_RT15-Jun-06 20:45
Hamid_RT15-Jun-06 20:45 
AnswerRe: how to Lock the screen when we shut the window? Pin
xuwenq8816-Jun-06 5:59
xuwenq8816-Jun-06 5:59 
QuestionCOleVariant, Unicode and truncated strings Pin
lastgen15-Jun-06 19:16
lastgen15-Jun-06 19:16 
AnswerRe: COleVariant, Unicode and truncated strings Pin
Michael Dunn15-Jun-06 20:40
sitebuilderMichael Dunn15-Jun-06 20:40 
AnswerRe: COleVariant, Unicode and truncated strings [modified] Pin
Viorel.15-Jun-06 21:57
Viorel.15-Jun-06 21:57 
If no other solution, you can use an alternative approach, based on STL strings: std::wstring for Unicode or std::string for ANSI. This kind of strings allows null character within the string.

For instance:

std::wstring s = L"abc";
s += L'\0'; // put null character after 'c'
s += L"def";

size_t length = s.length(); // now length is 7

wchar_t c;
c = s[2]; // now c is 'c'
c = s[3]; // now c is 0
c = s[4]; // now c is 'd'

const wchar_t * p = s.c_str(); // now p points to array of 8 characters, including final null character.

Next, if you need this as OLE variant, I think you can use "safe arrays" for this. For instance, this fragment copies the above string to a safe array:

CComSafeArray< USHORT > sa;
sa.Add(s.length() + 1, (USHORT*)p);

Hope it helps.

-- modified at 3:58 Friday 16th June, 2006
GeneralRe: COleVariant, Unicode and truncated strings Pin
lastgen15-Jun-06 22:13
lastgen15-Jun-06 22:13 
Questionhelp me out for spawning error. Pin
nitinjdalal15-Jun-06 18:52
nitinjdalal15-Jun-06 18:52 
AnswerRe: help me out for spawning error. Pin
Aqueel15-Jun-06 20:48
Aqueel15-Jun-06 20:48 
GeneralThanks Aqueel. Pin
nitinjdalal16-Jun-06 4:17
nitinjdalal16-Jun-06 4:17 
Questionsave complete web page(html,gif et al) Pin
shuchigo_jane15-Jun-06 18:49
shuchigo_jane15-Jun-06 18:49 
AnswerRe: save complete web page(html,gif et al) Pin
Ganesh_T15-Jun-06 19:00
Ganesh_T15-Jun-06 19:00 
QuestionDatabase Connection Pin
velayudhan_raj15-Jun-06 18:41
velayudhan_raj15-Jun-06 18:41 
AnswerRe: Database Connection Pin
_AnsHUMAN_ 15-Jun-06 18:44
_AnsHUMAN_ 15-Jun-06 18:44 
GeneralRe: Database Connection Pin
velayudhan_raj15-Jun-06 18:48
velayudhan_raj15-Jun-06 18:48 
QuestionSafe Array Pin
satsumatable15-Jun-06 18:21
satsumatable15-Jun-06 18:21 
AnswerRe: Safe Array Pin
alan top15-Jun-06 18:50
alan top15-Jun-06 18:50 
AnswerRe: Safe Array Pin
Laxman Auti15-Jun-06 22:44
Laxman Auti15-Jun-06 22:44 
Questionlistboxctrl update Pin
locoone15-Jun-06 17:41
locoone15-Jun-06 17:41 
AnswerRe: listboxctrl update Pin
Naveen15-Jun-06 18:24
Naveen15-Jun-06 18:24 
GeneralRe: listboxctrl update Pin
locoone16-Jun-06 11:36
locoone16-Jun-06 11:36 
AnswerRe: listboxctrl update Pin
Ganesh_T15-Jun-06 18:39
Ganesh_T15-Jun-06 18:39 
GeneralRe: listboxctrl update Pin
locoone16-Jun-06 12:16
locoone16-Jun-06 12:16 

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.