CoInitialize_ & MessageRequester

Just starting out? Need help? Post your questions and find answers here.
Phantomas
User
User
Posts: 96
Joined: Wed Jul 01, 2009 12:59 pm

CoInitialize_ & MessageRequester

Post by Phantomas »

Hello. Some Issue with CoInitialize_ API function and MessageRequester.

In this code CoInitialize_ return 0 (zero):

Code: Select all

MessageBox_(0, "", "", 0)
Debug CoInitialize_(0)
Here CoInitialize_ return 1:

Code: Select all

MessageRequester("", "")
Debug CoInitialize_(0)
What's wrong with MessageRequester?
Last edited by Phantomas on Mon Feb 02, 2015 3:25 pm, edited 1 time in total.
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: CoInitialize_ & MessageRequester

Post by luis »

What's wrong with MessageRequester?
I think PB calls Coinitialize() somewhere for some reason.

When displaying a requester in general it seems:

Code: Select all

InputRequester("", "", "")
Debug CoInitialize_(0)

Code: Select all

ColorRequester()
Debug CoInitialize_(0)

Code: Select all

FontRequester("Arial", 10, #PB_FontRequester_Effects)
Debug CoInitialize_(0)
etc.

This is more a side-effect than a bug IMO, like this one -> http://www.purebasic.fr/english/viewtop ... =4&t=61239
MSDN wrote:Subsequent calls to CoInitialize or CoInitializeEx on the same thread will succeed, as long as they do not attempt to change the concurrency model, but will return S_FALSE
That's probably why you get 1 (#S_FALSE) in your second snippet.
"Have you tried turning it off and on again ?"
A little PureBasic review
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: CoInitialize_ & MessageRequester

Post by Fred »

There is nothing wrong, PB commands can call any API internally for its own purpose. MessageRequester() isn't just a wrapper to MessageBox_() and handle also all program window locking.
Post Reply