Click here to Skip to main content
16,004,854 members
Home / Discussions / COM
   

COM

 
Generalimplementing COM in c++ Pin
csharp627-Feb-05 18:19
csharp627-Feb-05 18:19 
GeneralRe: implementing COM in c++ Pin
Anuj Mishra2-Mar-05 18:10
Anuj Mishra2-Mar-05 18:10 
Generaltips on how start mfc & vc++ Pin
yogesh tillu26-Feb-05 5:56
sussyogesh tillu26-Feb-05 5:56 
GeneralRe: tips on how start mfc & vc++ Pin
Anonymous27-Feb-05 2:49
Anonymous27-Feb-05 2:49 
GeneralRe: tips on how start mfc & vc++ Pin
ThatsAlok11-Mar-05 2:09
ThatsAlok11-Mar-05 2:09 
GeneralSysAllocString() allocation Pin
abc87624-Feb-05 22:54
abc87624-Feb-05 22:54 
GeneralRe: SysAllocString() allocation Pin
geo_m26-Feb-05 7:54
geo_m26-Feb-05 7:54 
GeneralRe: SysAllocString() allocation Pin
Jörgen Sigvardsson26-Feb-05 8:05
Jörgen Sigvardsson26-Feb-05 8:05 
I believe it's allocated on the COM heap.


M.Shoaib Khan wrote:
LPWSTR allocated with CoTaskMemAlloc() doesnot have size in its start, how does COM decide whether to check size from start of string or check for null terminating string??

When COM allocates a BSTR, it does something like this:
struct _BSTR {
   int length;
   OLECHAR str[1];
};
 
BSTR SysAllocString(LPCOLESTR src) 
{
    int bstr_len = wcslen(src) + 1; // 1 for NUL character
    _BSTR* bstr = CoTaskMemAlloc(bstr_len * sizeof(OLECHAR) + sizeof(int));
    bstr->length = bstr_len;
    wcscpy(bstr->str, src, bstr_len - 1);
    return bstr->str;
}
As you can see, a BSTR really isn't a LPWSTR. It just appears to be. Smile | :)

--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
My name in Mandarin/Kanji is 乔尔根 西格瓦德森.

I blog too now[^]

Generalwhy my com dll could not be imported Pin
williamchou24-Feb-05 15:26
williamchou24-Feb-05 15:26 
GeneralTlbImp.exe Pin
ursus zeta6-Mar-05 12:11
ursus zeta6-Mar-05 12:11 
GeneralWMI Blues Pin
newbee7824-Feb-05 4:41
newbee7824-Feb-05 4:41 
GeneralStart learning COM Pin
vuthaianh24-Feb-05 0:21
vuthaianh24-Feb-05 0:21 
GeneralRe: Start learning COM Pin
rwestgraham24-Feb-05 11:22
rwestgraham24-Feb-05 11:22 
GeneralRe: Start learning COM Pin
Fragging14-Mar-05 8:31
Fragging14-Mar-05 8:31 
GeneralWord document to stream Pin
jan larsen23-Feb-05 21:34
jan larsen23-Feb-05 21:34 
GeneralRe: Word document to stream Pin
vishalmore23-Feb-05 23:09
vishalmore23-Feb-05 23:09 
GeneralRe: Word document to stream Pin
jan larsen23-Feb-05 23:44
jan larsen23-Feb-05 23:44 
GeneralRe: Word document to stream Pin
vishalmore1-Mar-05 2:39
vishalmore1-Mar-05 2:39 
GeneralRe: Word document to stream Pin
jan larsen1-Mar-05 2:49
jan larsen1-Mar-05 2:49 
GeneralRe: Word document to stream Pin
jan larsen2-Mar-05 1:08
jan larsen2-Mar-05 1:08 
GeneralRe: Word document to stream Pin
Jörgen Sigvardsson26-Feb-05 8:08
Jörgen Sigvardsson26-Feb-05 8:08 
GeneralRe: Word document to stream Pin
jan larsen27-Feb-05 20:05
jan larsen27-Feb-05 20:05 
Generalextracting mail from yahoo using mozilla Pin
Spiritofamerica23-Feb-05 5:09
Spiritofamerica23-Feb-05 5:09 
GeneralC++ Client for a C# object Pin
Fragging22-Feb-05 9:14
Fragging22-Feb-05 9:14 
GeneralRe: C++ Client for a C# object Pin
Fragging28-Feb-05 3:08
Fragging28-Feb-05 3:08 

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.