Click here to Skip to main content
15,909,898 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralEject a CD Pin
Antony B.18-Jul-02 3:40
sussAntony B.18-Jul-02 3:40 
GeneralRe: Eject a CD Pin
Bernhard18-Jul-02 3:48
Bernhard18-Jul-02 3:48 
GeneralRe: Eject a CD Pin
Ravi Bhavnani18-Jul-02 3:49
professionalRavi Bhavnani18-Jul-02 3:49 
GeneralCurrent Data and time as string Pin
Aaron Schaefer18-Jul-02 3:39
Aaron Schaefer18-Jul-02 3:39 
GeneralRe: Current Data and time as string Pin
Fredrik Skog18-Jul-02 3:46
Fredrik Skog18-Jul-02 3:46 
GeneralRe: Current Data and time as string Pin
Aaron Schaefer18-Jul-02 9:00
Aaron Schaefer18-Jul-02 9:00 
GeneralIXMLDOMDocument Question... Pin
Tzoockee18-Jul-02 3:27
Tzoockee18-Jul-02 3:27 
GeneralRe: IXMLDOMDocument Question... Pin
Stuart Dootson18-Jul-02 9:04
professionalStuart Dootson18-Jul-02 9:04 
1. You don't create a BSTR like that.

Firstly, IIRC, BSTRs have the length embedded before the BSTR address (like Pascal strings), so either use ::SysAllocString or one of the BSTR wrappers in VC++ (_bstr_t or CComBSTR (well, that's in ATL, but hey!)).

Secondly, you can't just cast a char string (i.e. "aa") to OLECHAR* - OLECHARs on Win32 are wchar_t (16 bit), not char (8 bit), so you need to convert the ASCII string to a wide character string. There is an API function to do it, but it's more hassle than I can be bothered with Smile | :) , so I just use one of the wrappers, as they have a constructor to do the required conversion:
CComBSTR bs = "aa";

The wrapper also deallocates the BSTR afterwards, which helps.

2. You really want to pass VARIANT_BOOL values rather than BOOL values as boolean parameters - in this case, FALSE == VARIANT_FALSE, but using VARIANT_FALSE gets you in the right mindset.

3. (And this is the major reason it won't work as is!) "aa" is NOT a well-formed XML document (which is what loadXML expects). The following would be OK:
<aa/>
<aa></aa>


Stuart Dootson

'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
QuestionHTML Views ? Pin
Jon Hulatt18-Jul-02 3:25
Jon Hulatt18-Jul-02 3:25 
AnswerRe: HTML Views ? Pin
benjymous18-Jul-02 5:59
benjymous18-Jul-02 5:59 
GeneralMs Word Automation Hell... Pin
Braulio Dez18-Jul-02 3:15
Braulio Dez18-Jul-02 3:15 
GeneralCMenu::AppendMenu and CommandID's Pin
Anonymous18-Jul-02 2:57
Anonymous18-Jul-02 2:57 
GeneralFile overwriting... Pin
Raphael Kindt18-Jul-02 2:54
Raphael Kindt18-Jul-02 2:54 
GeneralRe: File overwriting... Pin
Anonymous18-Jul-02 3:04
Anonymous18-Jul-02 3:04 
GeneralRe: File overwriting... Pin
Raphael Kindt18-Jul-02 3:08
Raphael Kindt18-Jul-02 3:08 
GeneralRe: File overwriting... Pin
Anonymous18-Jul-02 3:26
Anonymous18-Jul-02 3:26 
GeneralRe: File overwriting... Pin
Fredrik Skog18-Jul-02 3:29
Fredrik Skog18-Jul-02 3:29 
GeneralRe: File overwriting... Pin
Raphael Kindt18-Jul-02 3:39
Raphael Kindt18-Jul-02 3:39 
GeneralRe: File overwriting... Pin
Fredrik Skog18-Jul-02 3:43
Fredrik Skog18-Jul-02 3:43 
GeneralRe: File overwriting... Pin
Raphael Kindt18-Jul-02 3:52
Raphael Kindt18-Jul-02 3:52 
GeneralRe: File overwriting... Pin
Fredrik Skog18-Jul-02 4:01
Fredrik Skog18-Jul-02 4:01 
GeneralRe: File overwriting... Pin
Fredrik Skog18-Jul-02 4:16
Fredrik Skog18-Jul-02 4:16 
GeneralRe: File overwriting... Pin
Raphael Kindt18-Jul-02 4:32
Raphael Kindt18-Jul-02 4:32 
GeneralRe: File overwriting... Pin
Raphael Kindt18-Jul-02 4:13
Raphael Kindt18-Jul-02 4:13 
GeneralRe: File overwriting... Pin
Raphael Kindt18-Jul-02 4:48
Raphael Kindt18-Jul-02 4:48 

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.