Re: MFC and number of times COM intialized
- From: one-trick-pony <worldofpain.aamir@xxxxxxxxx>
- Date: Tue, 07 Aug 2007 06:43:00 -0700
It is a single threaded application. To elaborate some more,
void main ( void )
{
func1();
func2();
}
void func1( )
{
CoInitialize(somearguments);
/* Do something here */
CoUninitialize();
}
void func2( )
{
CoInitialize(somearguments);
/* Do something here */
CoUninitialize();
}
As you can see a single threaded application that intializes and
uninitialized COM multiple times. I thought this was illegal. This
is one of the methods. The other method is calling COM intialize and
unitialize routine only once as shown below.
void main ( void )
{
CoInitialize(somearguments);
func1();
func2();
CoUninitialize();
}
void func1( )
{
/* Do something here */
}
void func2( )
{
/* Do something here */
}
Latter method is valid because it was the one I was told is accurate.
But SDK sample states COM can be intialized and unitialized as many
times as desired. Therefore, my conclusion is both methods are
correct.
.
- Prev by Date: CListCtrl, adding icons without ImageList
- Next by Date: Re: CSocket stops receiving
- Previous by thread: CListCtrl, adding icons without ImageList
- Next by thread: CreateDialogIndirect()'s silent failure...
- Index(es):
Relevant Pages
|