没有问题啊, 你试试下面的代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TTestThread = class(TThread)
public
procedure Execute;
override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
ActiveX, ComObj;
procedure TForm1.Button1Click(Sender: TObject);
begin
TTestThread.Create(False);
end;
{ TTestThread }
procedure TTestThread.Execute;
var
WordApp: Variant;
begin
CoInitialize(nil);
WordApp := CreateOleObject('Word.Application');
WordApp.Visible := True;
CoUninitialize;
end;
end.