Form.Create(Sender: TObject) begin Coinitialize end;
是否用了多线程? 如是,在该线程里加上CoInitialize和CoUninitialize。 原因如下(引自msdn): This function initializes the COM library on the current thread and identifies the concurrency model as single-thread apartment (STA). Applications must initialize the COM library before they can call COM library functions other than CoGetMalloc and memory allocation functions.
否则就是你的Delphi不对。
begin
Coinitialize
end;
如是,在该线程里加上CoInitialize和CoUninitialize。
原因如下(引自msdn):
This function initializes the COM library on the current thread and identifies the concurrency model as single-thread apartment (STA). Applications must initialize the COM library before they can call COM library functions other than CoGetMalloc and memory allocation functions.