Click here to Skip to main content
16,004,969 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralInstall Shield Express 5.0 Pin
nnvidya31-Aug-04 0:00
nnvidya31-Aug-04 0:00 
GeneralRe: Install Shield Express 5.0 Pin
nguyenvhn31-Aug-04 2:54
nguyenvhn31-Aug-04 2:54 
GeneralRe: Install Shield Express 5.0 Pin
nnvidya31-Aug-04 19:34
nnvidya31-Aug-04 19:34 
GeneralSoftware based Input Panel Pin
agrawal30-Aug-04 23:21
agrawal30-Aug-04 23:21 
GeneralRe: Software based Input Panel Pin
Antony M Kancidrowski31-Aug-04 4:10
Antony M Kancidrowski31-Aug-04 4:10 
GeneralRe: Software based Input Panel Pin
agrawal2-Sep-04 3:05
agrawal2-Sep-04 3:05 
GeneralDirectShow + COM + IGraphBuilder = Confused! Pin
Jon Hulatt30-Aug-04 22:13
Jon Hulatt30-Aug-04 22:13 
GeneralRe: DirectShow + COM + IGraphBuilder = Confused! Pin
Andrew Walker31-Aug-04 0:03
Andrew Walker31-Aug-04 0:03 
Jon Hulatt wrote:
Are there any tools available that can list instances of COM objects that I create, and spy on their reference counts?

The easiest way is by inspection of the value returned by release - however remember that functions that correctly obey the rules of COM will AddRef / Release depending on the parameter type (for example adding a filter to a graph is an [in] parameter which will force an AddRef), so you'll have to compensate for this when you look at the values.

However, if possible, you don't want to be doing this. COM, and especially DirectShow are hideously frustrating beasts to cleanup (as I'm sure you've found out Smile | :) ), so much so that you really don't want to have to.

Where possible use smart pointers which abstract away the intricies of calling AddRef and Release. The two most obvious starting points are boost::shared_ptr (which will need a custom delete function) or the CComPtr / CComQIPtr classes provided as part of ATL.

One of the other things I've learnt from experience is that when DirectShow applications start to fall over, they do it in a really big way. Make sure that each operation that you complete can be rolled back. This becomes fairly nasty if something throws an exception - the only solutions I've found for this is to use RAII for each operation (for example adding filters or connecting pins) that you complete on a graph.

* Create the graph and DirectShow interfaces
* Create Filters
* Add the filters to the graph
* Set the properties for the filters in the graph (this step may need to be repeated / delayed until after having connected the pins of the filters)
* Connect the pins for the filters (I do this manually to avoid the chance that DirectShow will insert intermediate filters in stupid places)
* Start the graph

Do the operations for your application

* Stop the graph
* Disconnect the pins of the filters
* Remove the filters
* Destroy the filters
* Destroy the graph and DirectShow interfaces


If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.

Rudyard Kipling

GeneralRe: DirectShow + COM + IGraphBuilder = Confused! Pin
Jon Hulatt31-Aug-04 0:09
Jon Hulatt31-Aug-04 0:09 
GeneralRe: DirectShow + COM + IGraphBuilder = Confused! Pin
Andrew Walker31-Aug-04 0:34
Andrew Walker31-Aug-04 0:34 
GeneralPrint to file Pin
r i s h a b h s30-Aug-04 22:08
r i s h a b h s30-Aug-04 22:08 
GeneralLinking files from subprojects Pin
jrichardson8530-Aug-04 22:07
jrichardson8530-Aug-04 22:07 
QuestionHow to find the exe name? Pin
baskarchinnu30-Aug-04 21:34
baskarchinnu30-Aug-04 21:34 
AnswerRe: How to find the exe name? Pin
4apai30-Aug-04 23:02
4apai30-Aug-04 23:02 
AnswerRe: How to find the exe name? Pin
Archer28231-Aug-04 17:09
Archer28231-Aug-04 17:09 
GeneralAnother Release Bugs... Pin
DjChris1430-Aug-04 21:03
DjChris1430-Aug-04 21:03 
GeneralRe: Another Release Bugs... Pin
Graham Bradshaw30-Aug-04 23:26
Graham Bradshaw30-Aug-04 23:26 
GeneralRe: Another Release Bugs... Pin
DjChris1431-Aug-04 19:30
DjChris1431-Aug-04 19:30 
Generalprogramming source code in creating specific packet over ethernet Pin
jychin30-Aug-04 20:54
jychin30-Aug-04 20:54 
GeneralRe: programming source code in creating specific packet over ethernet Pin
Henry miller31-Aug-04 4:15
Henry miller31-Aug-04 4:15 
GeneralRe: programming source code in creating specific packet over ethernet Pin
jychin31-Aug-04 19:16
jychin31-Aug-04 19:16 
GeneralRe: programming source code in creating specific packet over ethernet Pin
Anonymous5-Oct-04 14:30
Anonymous5-Oct-04 14:30 
GeneralRe: programming source code in creating specific packet over ethernet Pin
jychin6-Oct-04 16:55
jychin6-Oct-04 16:55 
QuestionHow to get the Size of Requests with ISAPI Pin
raed30-Aug-04 20:50
raed30-Aug-04 20:50 
AnswerRe: How to get the Size of Requests with ISAPI Pin
xiaolonghong12317-Jan-09 20:54
xiaolonghong12317-Jan-09 20:54 

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.