Hi Benoit,
On the documentation at System/Drivers/Win32 you can read:
IupOpen calls "CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);", if you
need another concurrency model call CoInitializeEx with other options before
calling IupOpen. Be aware that some features in some controls require
single-thread apartment, and they will stop working, this includes:
IupFileDLg when selecting a folder, and IupOleControl.
As you figure it out already you has to do your call before IUP but it
will have consequences.
I was not aware that this would affect also the Visual Styles. I searched
through the Win32 API documentation and found no relation between the two.
I think you can call CoInitializeEx with COINIT_MULTITHREADED in a second
thread without affecting the main thread.
BTW, in the next IUP version, CoInitializeEx should be replaced by
OleInitialize because of the new drag and drop support. Internally
OleInitialize the CoInitializeEx is called for single thread anyway.
Best,
Scuri
From: Benoit Germain [mailto:[email protected]]
Sent: terça-feira, 5 de junho de 2012 09:18
To: IUP discussion list
Subject: [Iup-users] [IUP 3.5, Windows 7] little problem with threading
model passed to CoInitializeEx
Hello,
I have a Lua binding that initializes the services it binds by calling
CoInitializeEx( 0x0, COINIT_MULTITHREADED|COINIT_SPEED_OVER_MEMORY);
If I require iuplua before my module, my call to CoInitializeEx fails with
error 0x80010106 (Can't change threading model after it was set).
I've tried with COINIT_APARTMENTTHREADED, which is successful. I suppose
this means Iup uses this flag. However, this breaks some functionalities
provided by the library I bind, so I am stuck with using
COINIT_MULTITHREADED. I can then work around the initialization error by
requiring my binding before iuplua. But I suppose this means that iuplua's
initialization will fail in some fashion?
So far, Iuplua still works when doing this, with the strange side effect
that I have lost the Windows7 look and feel, and I am back to default
Windows NT style...
What can be done to make my binding and iuplua coexist without losing the
Windows7 style?
Regards,
--
Benoit.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users