Click here to Skip to main content
15,891,811 members
Home / Discussions / COM
   

COM

 
GeneralInterface - Class Pin
Karri Mohan14-Oct-08 0:40
Karri Mohan14-Oct-08 0:40 
AnswerRe: Interface - Class Pin
Roger Stoltz14-Oct-08 1:42
Roger Stoltz14-Oct-08 1:42 
AnswerRe: Interface - Class Pin
prasad_som16-Oct-08 5:01
prasad_som16-Oct-08 5:01 
QuestionVisual c++ in managed environment with Framework and no visualstudio Pin
balu1234513-Oct-08 21:48
balu1234513-Oct-08 21:48 
AnswerRe: Visual c++ in managed environment with Framework and no visualstudio Pin
alchong14-Oct-08 6:43
alchong14-Oct-08 6:43 
GeneralRe: Visual c++ in managed environment with Framework and no visualstudio Pin
balu1234514-Oct-08 7:11
balu1234514-Oct-08 7:11 
QuestionIt still gives "Unknown Publisher" error even after signing ActiveX control Pin
dharmesh@krishtechnologies.net8-Oct-08 23:22
dharmesh@krishtechnologies.net8-Oct-08 23:22 
QuestionReleasing CComPtr Pin
alchong8-Oct-08 13:34
alchong8-Oct-08 13:34 
Well, I have a question about the usuage of CComPtr, but I think I know the answer, but would like to make sure I understand this completely...

CComPtr is a smart pointer class for managing COM interface pointers, thus I don't need to worry about calling AddRef for Release methods, since they are automatically called. From what I've read, the Release method will be called when the CComPtr goes out of scope.

I'm have the task of maintaining a COM client app (first time with COM) and I was thinking about 'reusing' a particular instance of a CComPtr (no need to declare a new one, since there's one already!) The only thing that had me worried what that by reusing the CComPtr does that screw up the reference counting and create a memory leak... psuedocode below:

{

CComPtr<isomething> myIsomething = (some Isomething interface)

...do stuff to the CComPtr...

...lets reuse it...

myIsomething = (some other Isomething interface)

}

Since the myIsomething didn't go out of scope when I set "myIsomething" to another interface, I was worried that it may be an issue. So after a day of digging around this is my conclusion:

This is actually OK, since if we look at the definition of this template, the = operator is overloaded as such:

T* operator=(T* lp) {
return (T*)AtlComPtrAssign((IUnknown**)&p, lp);
}

When I looked up AtlComPtrAssign, it seems that it will call release on the interface pointer, prior to reassignment to the new interface. If that's true, there shouldn't be any issues with reference counting and I can continue on my merry way?
AnswerRe: Releasing CComPtr Pin
Lim Bio Liong8-Oct-08 18:45
Lim Bio Liong8-Oct-08 18:45 
GeneralRe: Releasing CComPtr Pin
alchong9-Oct-08 5:57
alchong9-Oct-08 5:57 
QuestionDCOM Config Pin
Kipetcoff8-Oct-08 5:26
Kipetcoff8-Oct-08 5:26 
QuestionLaunch as interactive user Pin
SteveTheHalfB8-Oct-08 4:44
SteveTheHalfB8-Oct-08 4:44 
AnswerRe: Launch as interactive user Pin
SteveTheHalfB12-Oct-08 23:53
SteveTheHalfB12-Oct-08 23:53 
QuestionAssertion failed: _pAtlModule == 0 Pin
Christian Bayer6-Oct-08 6:51
Christian Bayer6-Oct-08 6:51 
QuestionRuns on Server, not on Workstations Pin
rahvyn133-Oct-08 6:32
rahvyn133-Oct-08 6:32 
QuestionHeaders created by MIDL, position of DECLSPEC_UUID Pin
Andreas Tondorf1-Oct-08 22:13
Andreas Tondorf1-Oct-08 22:13 
QuestionHow do I pass MySQL connection ID to COM using VC++ 9.0? Pin
Ger Hayden30-Sep-08 7:22
Ger Hayden30-Sep-08 7:22 
QuestionCOM add in for MS Office Outlook? Pin
maui_mike29-Sep-08 20:19
maui_mike29-Sep-08 20:19 
QuestionMMDeviceEnumerator registration problem Pin
punitkumar2629-Sep-08 13:09
punitkumar2629-Sep-08 13:09 
QuestionUsing C# and COM to connect to a Server Pin
SRogers8829-Sep-08 7:44
SRogers8829-Sep-08 7:44 
AnswerRe: Using C# and COM to connect to a Server Pin
alchong8-Oct-08 14:19
alchong8-Oct-08 14:19 
QuestionGet COM pointer to running instance of Yahoo Messenger. Pin
u0m326-Sep-08 7:02
u0m326-Sep-08 7:02 
QuestionHow to Include MFC Datatypes in IDl ? Pin
narayanagvs25-Sep-08 23:20
narayanagvs25-Sep-08 23:20 
QuestionExtra Chart in OWC11 (ASP)! Pin
marlboroguy5824-Sep-08 1:35
marlboroguy5824-Sep-08 1:35 
QuestionWord Automation Pin
g_dev23-Sep-08 18:37
g_dev23-Sep-08 18:37 

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.