Click here to Skip to main content
15,917,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: openGL and MFC Pin
Mike Nordell15-Aug-02 18:33
Mike Nordell15-Aug-02 18:33 
GeneralRe: openGL and MFC Pin
Ernest Laurentin15-Aug-02 19:05
Ernest Laurentin15-Aug-02 19:05 
GeneralRe: openGL and MFC Pin
Roman Fadeyev15-Aug-02 23:32
Roman Fadeyev15-Aug-02 23:32 
GeneralRe: openGL and MFC Pin
lucy16-Aug-02 11:06
lucy16-Aug-02 11:06 
GeneralRe: openGL and MFC Pin
pankajdaga19-Aug-02 0:11
pankajdaga19-Aug-02 0:11 
GeneralINVALID_SET_FILE_POINTER isn't declared anywhere... Pin
redeemer15-Aug-02 11:06
redeemer15-Aug-02 11:06 
GeneralRe: INVALID_SET_FILE_POINTER isn't declared anywhere... Pin
Mukkie15-Aug-02 22:36
Mukkie15-Aug-02 22:36 
Questionmemory leak if I do this? Pin
ns15-Aug-02 10:31
ns15-Aug-02 10:31 
In a function I have a local connection object declared as m_pConn1:

Ihad trouble working with a member variable so I made it local. The code works now but each time the function is called:

    _ConnectionPtr m_pConn1;
HRESULT hr = m_pConn1.CreateInstance (__uuidof (Connection));

if (FAILED (hr))
{
    AfxMessageBox ("Can't create intance of Connection");
}



if (FAILED (m_pConn1->Open (_bstr_t ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = "+PhotoDBName ),
            _bstr_t (""), _bstr_t (""), adModeUnknown)))
    {
    AfxMessageBox ("Can't open datasource");
    return 0 ;
    }



My hope is that the object gets destroyed when the function goes out of scope. Is thsi true or am I setting myself up for a massive memory leak?

I seem to remember something about this _ConnectionPtr being a smart pointer but maybe thats just wishful thinking. DOes anyone have any experience with this? Your suggestions are welcome. I'd not have done it this way but no other way seemed to work. I tried for two days and finally went this route.

Thanks,
ns
AnswerRe: memory leak if I do this? Pin
Ranjan Banerji15-Aug-02 10:44
Ranjan Banerji15-Aug-02 10:44 
GeneralRe: memory leak if I do this? Pin
ns15-Aug-02 10:51
ns15-Aug-02 10:51 
AnswerRe: memory leak if I do this? Pin
Jason Henderson15-Aug-02 11:24
Jason Henderson15-Aug-02 11:24 
GeneralRe: memory leak if I do this? Pin
Tom Welch16-Aug-02 9:59
Tom Welch16-Aug-02 9:59 
GeneralRe: memory leak if I do this? Pin
Jason Henderson16-Aug-02 10:36
Jason Henderson16-Aug-02 10:36 
GeneralRe: memory leak if I do this? Pin
Jo Fredrickson1-Jun-04 21:40
Jo Fredrickson1-Jun-04 21:40 
GeneralRe: memory leak if I do this? Pin
Jason Henderson2-Jun-04 3:25
Jason Henderson2-Jun-04 3:25 
Question3rd Party Development Tools? Suggestions? Pin
Ryan B.15-Aug-02 8:49
Ryan B.15-Aug-02 8:49 
GeneralSockets related Pin
Shamoon15-Aug-02 8:26
Shamoon15-Aug-02 8:26 
GeneralRe: Sockets related Pin
Ryan B.15-Aug-02 8:41
Ryan B.15-Aug-02 8:41 
GeneralRe: Sockets related Pin
lucy15-Aug-02 8:57
lucy15-Aug-02 8:57 
GeneralRe: Sockets related Pin
Anders Molin15-Aug-02 9:58
professionalAnders Molin15-Aug-02 9:58 
GeneralRe: Aha ! Pin
Masaaki Onishi15-Aug-02 18:01
Masaaki Onishi15-Aug-02 18:01 
GeneralGetting a text from an HTML format Pin
Atlence15-Aug-02 8:03
Atlence15-Aug-02 8:03 
GeneralRe: Getting a text from an HTML format Pin
Ranjan Banerji15-Aug-02 10:16
Ranjan Banerji15-Aug-02 10:16 
GeneralRe: Getting a text from an HTML format Pin
Ravi Bhavnani15-Aug-02 11:42
professionalRavi Bhavnani15-Aug-02 11:42 
GeneralCan't figure out Icons for CTreeCtrl Pin
brianwelsch15-Aug-02 7:44
brianwelsch15-Aug-02 7:44 

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.