🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11654

Re: CoInitializeEx

#11654
From: Remy Lebeau (TeamB)
Date: Wed, 28 Jan 2004 03:07
27 lines
2053 bytes
"nicolasr" <nicolasrNOSPAMATSIGNgmx.net> wrote in message
news:40171ad2$1@newsgroups.borland.com...

> I tried setting the CoInitFlags in the test projects WinMain before
> this call and the error is gone.

Officially, you're actually supposed to be setting the option in the ATL
section of the Project Options.  Setting the CoInitFlags manually in code is
actually a hack for a bug in the IDE that doesn't always apply the
appropriate ATL settings correctly.

> The problem is, however, that I'm writing a component and I think that
> I don't have access to the users WinMain.

Correct.

> So I think that the only option is to tell the user that he
> need initialize COM for multi-threading himself.

A better approach, and one that you can keep inside your own code, is to
have the component spawn a separate thread internally to do the actual COM
work.  Then you can initialize the thread however you want regardless of how
the calling thread is initialized.


Gambit
Technical Details
Message-ID: <401725d4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4012ffb1$1@newsgroups.borland.com> <40150765$1@newsgroups.borland.com> <40155c5b@newsgroups.borland.com> <4016278c$2@newsgroups.borland.com> <4016bfc8$1@newsgroups.borland.com> <40171ad2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,415206d9c16e00b1
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-27 19:10:03 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References:  <4012ffb1$1@newsgroups.borland.com> <40150765$1@newsgroups.borland.com> <40155c5b@newsgroups.borland.com> <4016278c$2@newsgroups.borland.com> <4016bfc8$1@newsgroups.borland.com> <40171ad2$1@newsgroups.borland.com>
Subject: Re: CoInitializeEx
Date: Tue, 27 Jan 2004 19:07:31 -0800
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.138.253
Message-ID: <401725d4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1075258836 67.22.138.253 (27 Jan 2004 19:00:36 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail