[supersaibal]
Ever get the "CoInitialize has not been called" (800401F0 hex) error?
Sì.. ricompilando la stessa applicazione con delphi 7, l'errore cambia ma la motivazione dell'errore è la stessa.. almeno a detta della Borland
Each thread in your application that interacts with COM (i.e. creates COM objects, calls COM APIs, etc.) must initialize itself into an apartment. A thread can either join a single threaded apartment (STA) or the multithreaded apartment (MTA).
The STA is system-synchronized based on a windows message queue. Use the STA if your object or thread relies on thread-relative resources such as UI elements. The following shows how to initialize a thread into an STA:
procedure FooThreadFunc; //or TFooThread.Execute
begin
CoInitializeEx (NIL, COINIT_APARTMENTTHREADED);
... do your stuff here ...
CoUninitialize;
end;
The MTA is system-guaranteed to be ruthless. Objects in the MTA will receive incoming calls from anywhere anytime. Use the MTA for non-UI related objects, but synchronize carefully! The following shows how to initialize a thread into the MTA:
procedure FooThreadFunc; //or TFooThread.Execute
begin
CoInitializeEx (NIL, COINIT_MULTITHREADED);
... do your stuff here ...
CoUninitialize;
end; [/supersaibal]