Click here to Skip to main content
15,913,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Memory leak Pin
MaximE12-Oct-02 11:29
MaximE12-Oct-02 11:29 
Jesus!!! Does this code work???

<br />
(_bstr_t)"DATABASE/TABLE[@Left]"<br />

What is this? Never, never do like this. Do:
<br />
_bstr_t(OLESTR("DATABASE/TABLE[@Left]"))<br />


<br />
pIXMLDOMNode->Release();<br />
pIXMLDOMNode=NULL;<br />

It's not bad, but pIXMLDOMNode = 0 is enough.

<br />
(LPARAM)(char *)(_bstr_t)Tablename<br />

Should be:
<br />
reinterpret_cast<LPARAM>(static_cast<TCHAR*>(_bstr_t(Tablename)))<br />

Such a bad cast should be explicit.

<br />
pIXMLDOMNode->get_attributes(&pIXMLDOMNamedNodeMap1);<br />

You are working with very smart pointer. Instead, do like this:
<br />
pIXMLDOMNamedNodeMap1 = pIXMLDOMNode->attributes;<br />


What is:
<br />
CHECK_AND_RELEASE(pIXMLDOMDocument2);<br />

May be it a:
<br />
#define CHECK_AND_RELEASE(x) x->AddRef()<br />

I don't know.

Summary.
1. Never, never use c-casts (like (_bstr_t)x, (LPARAM)y, etc). They are the worst evil, unless you damn sure that you do. It's very hard to find a bug in a such code.
2. Read about _com_ptr_t. Learn how it's intended to use.
3. Avoid macros.
4. Optional, but strongly recommended. Get a Stroustrup.
QuestionHow can i simple add a JPG image to my Dialog based application Pin
whofmans12-Oct-02 1:54
whofmans12-Oct-02 1:54 
AnswerRe: How can i simple add a JPG image to my Dialog based application Pin
Michael P Butler12-Oct-02 2:00
Michael P Butler12-Oct-02 2:00 
AnswerRe: How can i simple add a JPG image to my Dialog based application Pin
Nish Nishant12-Oct-02 2:06
sitebuilderNish Nishant12-Oct-02 2:06 
GeneralCopy - rename Pin
Brakanjan12-Oct-02 1:49
Brakanjan12-Oct-02 1:49 
GeneralRe: Copy - rename Pin
Nish Nishant12-Oct-02 2:09
sitebuilderNish Nishant12-Oct-02 2:09 
GeneralRe: Copy - rename Pin
Brakanjan12-Oct-02 2:25
Brakanjan12-Oct-02 2:25 
GeneralRe: Copy - rename Pin
Nish Nishant12-Oct-02 3:50
sitebuilderNish Nishant12-Oct-02 3:50 
GeneralRe: Copy - rename Pin
Maximilien12-Oct-02 5:31
Maximilien12-Oct-02 5:31 
Questionhow to develop web stress test software? Pin
ricklau12-Oct-02 1:02
ricklau12-Oct-02 1:02 
AnswerRe: how to develop web stress test software? Pin
Nish Nishant12-Oct-02 1:06
sitebuilderNish Nishant12-Oct-02 1:06 
AnswerRe: how to develop web stress test software? Pin
Daniel Turini12-Oct-02 7:08
Daniel Turini12-Oct-02 7:08 
Generalcapture keystoke and screenshot in DOS mode Pin
shitij12-Oct-02 1:00
shitij12-Oct-02 1:00 
GeneralCapture fields in active window Pin
shitij12-Oct-02 0:58
shitij12-Oct-02 0:58 
GeneralRe: Capture fields in active window Pin
Nish Nishant12-Oct-02 1:02
sitebuilderNish Nishant12-Oct-02 1:02 
GeneralRe: how to develop web stress test software? Pin
Stephane Rodriguez.12-Oct-02 0:20
Stephane Rodriguez.12-Oct-02 0:20 
GeneralIncrease in Memory size Pin
suresh_sathya11-Oct-02 23:54
suresh_sathya11-Oct-02 23:54 
GeneralRe: Increase in Memory size Pin
Stephane Rodriguez.12-Oct-02 0:11
Stephane Rodriguez.12-Oct-02 0:11 
GeneralRe: Increase in Memory size-Could u pl help Pin
suresh_sathya12-Oct-02 0:39
suresh_sathya12-Oct-02 0:39 
GeneralRe: Increase in Memory size-Could u pl help Pin
Stephane Rodriguez.12-Oct-02 1:23
Stephane Rodriguez.12-Oct-02 1:23 
GeneralThe CImageList Problem! Pin
oly200211-Oct-02 23:37
oly200211-Oct-02 23:37 
GeneralRe: The CImageList Problem! Pin
Stephane Rodriguez.12-Oct-02 0:12
Stephane Rodriguez.12-Oct-02 0:12 
Generalmsado15.tlh problem Pin
stevenson11-Oct-02 23:09
stevenson11-Oct-02 23:09 
GeneralRe: msado15.tlh problem Pin
Stephane Rodriguez.12-Oct-02 0:15
Stephane Rodriguez.12-Oct-02 0:15 
GeneralProblem with using VC6 dlls in VC7 Pin
mariuszpopiolek11-Oct-02 23:06
mariuszpopiolek11-Oct-02 23:06 

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.