如何用delphi调用word打开一个文档

2025-05-21 20:34:49
推荐回答(1个)
回答(1):

使用函数 ShellExecute
function ShellExecute(hWnd: HWND; Operation, FileName, Parameters,Directory: PChar; ShowCmd: Integer): HINST; stdcall;
必须引用shellapi.pas单元:
uses ShellAPI;

begin
...
ShellExecute(Handle,'open','winword','D:\test.doc','',SW_SHOWNORMAL);
// winword 报错就写成 word
...
end;