Beginner's COM question (easy) 
Author Message
 Beginner's COM question (easy)

Is it standard to use Unicode characters in all COM interfaces? In other
words, should I always use "wchar_t" in place of "char" ? If so, then I
assume that COM development should NOT proceed using the Windows generic
text mapping types found in "tchar.h", such as _TCHAR, LPCTSTR and so forth.
Is that correct? If so, then this also means that I should always use
Unicode based functions for text manipulation. By the way, does it matter if
I use "wchar_t" directly or is OLECHAR and its cousins like LPOLESTR more
appropriate (I believe so). Thanks in advance.


Tue, 22 Jan 2002 03:00:00 GMT  
 Beginner's COM question (easy)
As far as I know the tchar.h is a conglomeration of stdlib.h and stddef.h
which are both ansi complient.
char is allowable for what you are doing in COM better yet you could use the
BSTR which is nothing more than a
pointer to an OLECHAR which is defined as a char anyway.
LPOLESTR  is defined as an  LPSTR or LPWSTR
LPSTR  is a TCHAR FAR *   and TCHAR is nothing more that a char.

So when it comes right down to it just use char it's ansii and you can't go
wrong.
I could go on with rantings and ravings of microsofts convaluted defines but
I won't.
Resistance is futile.  Just accept it and go on, otherwise you may actualy
talk yourself into
beleiving you understand and thats when you know it's over.  You have become
"MICRONIZED"

Steven Szelei


Quote:
> Is it standard to use Unicode characters in all COM interfaces? In other
> words, should I always use "wchar_t" in place of "char" ? If so, then I
> assume that COM development should NOT proceed using the Windows generic
> text mapping types found in "tchar.h", such as _TCHAR, LPCTSTR and so
forth.
> Is that correct? If so, then this also means that I should always use
> Unicode based functions for text manipulation. By the way, does it matter
if
> I use "wchar_t" directly or is OLECHAR and its cousins like LPOLESTR more
> appropriate (I believe so). Thanks in advance.



Tue, 22 Jan 2002 03:00:00 GMT  
 Beginner's COM question (easy)

Quote:
> As far as I know the tchar.h is a conglomeration of stdlib.h and stddef.h
> which are both ansi complient.
> char is allowable for what you are doing in COM better yet you could use
the
> BSTR which is nothing more than a
> pointer to an OLECHAR which is defined as a char anyway.
> LPOLESTR  is defined as an  LPSTR or LPWSTR
> LPSTR  is a TCHAR FAR *   and TCHAR is nothing more that a char.

No, BSTR and OLECHAR are ALWAYS Unicode because COM wants Unicode.  If you
are doing COM use OLECHAR/BSTR or you may go wrong.  OLECHAR/wchar are
interchangable, but DON'T try to use one of them in place of BSTR since BSTR
is a pointer to a length-prefixed Unicode string.  You'll be missing the
length bytes if you don't create BSTR's properly.

Quote:

> So when it comes right down to it just use char it's ansii and you can't
go
> wrong.
> I could go on with rantings and ravings of microsofts convaluted defines
but
> I won't.
> Resistance is futile.  Just accept it and go on, otherwise you may actualy
> talk yourself into
> beleiving you understand and thats when you know it's over.  You have
become
> "MICRONIZED"

> Steven Szelei



> > Is it standard to use Unicode characters in all COM interfaces? In other
> > words, should I always use "wchar_t" in place of "char" ? If so, then I
> > assume that COM development should NOT proceed using the Windows generic
> > text mapping types found in "tchar.h", such as _TCHAR, LPCTSTR and so
> forth.
> > Is that correct? If so, then this also means that I should always use
> > Unicode based functions for text manipulation. By the way, does it
matter
> if
> > I use "wchar_t" directly or is OLECHAR and its cousins like LPOLESTR
more
> > appropriate (I believe so). Thanks in advance.



Fri, 25 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Beginner's COM question (easy)

2. EASY EASY BEGINNER ??

3. Very easy beginners question

4. Beginner: CFile, a really easy(?) question

5. EASY Beginner question

6. This is a biztalk question but probably an easy question for you C# guru's

7. Real Fast 'n' Easy Question --

8. Easy Question for ppl with ATL/COM experience..

9. Easy question for COM veterans

10. COM question / beginner

11. A few beginner questions on arguments to COM Interface functions

12. beginner COM/ActiveX question...

 

 
Powered by phpBB® Forum Software