Click here to Skip to main content
15,905,963 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Calling a COM DLL(built in visual studio 2008) from a COM DLL VC++ (visual studio 6.0) Pin
Stuart Dootson23-Apr-09 21:11
professionalStuart Dootson23-Apr-09 21:11 
GeneralRe: Calling a COM DLL(built in visual studio 2008) from a COM DLL VC++ (visual studio 6.0) Pin
rana ray24-Apr-09 4:39
rana ray24-Apr-09 4:39 
GeneralRe: Calling a COM DLL(built in visual studio 2008) from a COM DLL VC++ (visual studio 6.0) Pin
Stuart Dootson24-Apr-09 7:39
professionalStuart Dootson24-Apr-09 7:39 
QuestionRe: Calling a COM DLL(built in visual studio 2008) from a COM DLL VC++ (visual studio 6.0) Pin
Roger Stoltz23-Apr-09 21:37
Roger Stoltz23-Apr-09 21:37 
AnswerRe: Calling a COM DLL(built in visual studio 2008) from a COM DLL VC++ (visual studio 6.0) Pin
rana ray24-Apr-09 4:57
rana ray24-Apr-09 4:57 
QuestionHow to retrieve the Windows media player's interface point where the WMP is embeded in web page. Pin
zhaoyu16222-Apr-09 19:30
zhaoyu16222-Apr-09 19:30 
QuestionHow to Convert String Array to LPWSTR* Pin
ANURAG VISHNOI22-Apr-09 18:43
ANURAG VISHNOI22-Apr-09 18:43 
AnswerRe: How to Convert String Array to LPWSTR* Pin
Stuart Dootson22-Apr-09 21:26
professionalStuart Dootson22-Apr-09 21:26 
Firstly, make sure you have the checkbox labelled "Auto-encode HTML when pasting?" ticked before you paste code. That way, your template parameter lists won't get hidden.

Secondly, your problem is that you are assigning the same string to each element of items. Nothing to do with memset.

Try this:

for(DWORD i = 0; i < itemIds->Count; i++)
{
   ATL::CComBSTR itemWChar;
   itemWChar = ::GetAtlBstr(itemIds[i]);
   WCHAR* _itemWChar = new WCHAR[itemWChar.ByteLength()]; 
   memset(_itemWChar, 0, sizeof(_itemWChar) / sizeof(_itemWChar[0]));
   memcpy(_itemWChar, static_cast<bstr>(itemWChar), itemWChar.ByteLength());
   items[i] = _itemWChar;
}


This allocates a new block of memory for each BSTR copy (don't forget to delete[] it!). BTW - if your BSTRs definitely contain wide characters, then you should probably use this code instead:

for(DWORD i = 0; i < itemIds->Count; i++)
{
   ATL::CComBSTR itemWChar;
   itemWChar = ::GetAtlBstr(itemIds[i]);
   WCHAR* _itemWChar = new WCHAR[itemWChar.Length()+1]; 
   wcsncpy(_itemWChar, static_cast<bstr>(itemWChar), itemWChar.Length());
   _itemWChar[itemWChar.Length()] = 0;
   items[i] = _itemWChar;
}


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: How to Convert String Array to LPWSTR* [modified] Pin
ANURAG VISHNOI22-Apr-09 23:33
ANURAG VISHNOI22-Apr-09 23:33 
QuestionSTL-set difference and intersection Pin
liquid_21-Apr-09 23:03
liquid_21-Apr-09 23:03 
AnswerRe: STL-set difference and intersection Pin
Stuart Dootson22-Apr-09 5:39
professionalStuart Dootson22-Apr-09 5:39 
GeneralRe: STL-set difference and intersection - works! Pin
liquid_22-Apr-09 21:15
liquid_22-Apr-09 21:15 
Questionconvertion vc6 to dotnet2008 Pin
Rajeesh MP17-Apr-09 2:37
Rajeesh MP17-Apr-09 2:37 
AnswerRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson17-Apr-09 9:08
professionalStuart Dootson17-Apr-09 9:08 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP17-Apr-09 18:44
Rajeesh MP17-Apr-09 18:44 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson17-Apr-09 19:07
professionalStuart Dootson17-Apr-09 19:07 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP17-Apr-09 19:44
Rajeesh MP17-Apr-09 19:44 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson17-Apr-09 21:22
professionalStuart Dootson17-Apr-09 21:22 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP18-Apr-09 0:50
Rajeesh MP18-Apr-09 0:50 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson18-Apr-09 1:19
professionalStuart Dootson18-Apr-09 1:19 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP21-Apr-09 0:59
Rajeesh MP21-Apr-09 0:59 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson21-Apr-09 2:00
professionalStuart Dootson21-Apr-09 2:00 
GeneralRe: convertion vc6 to dotnet2008 [modified] Pin
Rajeesh MP21-Apr-09 18:10
Rajeesh MP21-Apr-09 18:10 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson21-Apr-09 22:03
professionalStuart Dootson21-Apr-09 22:03 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP22-Apr-09 18:23
Rajeesh MP22-Apr-09 18:23 

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.