gpt4 book ai didi

Delphi 到 Windows 传真

转载 作者:行者123 更新时间:2023-12-03 15:23:35 28 4
gpt4 key购买 nike

任何人都知道如何使用 Windows 8 Fax true Delphi 发送传真。我的意思是我需要启动带有号码和 pdf 附件的 Windows 传真。有相关教程吗?谢谢。

最佳答案

例如,您可以使用Fax Service COM Interfaces。为了进行简单的操作,您可以导入 fxscomex.dll 库的类型库并使用如下代码(基于 this example ):

uses
ComObj, ActiveX, FAXCOMEXLib_TLB;

procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
JobIDs: OleVariant;
FaxServer: IFaxServer2;
FaxDocument: IFaxDocument2;
begin
try
FaxServer := CoFaxServer.Create;
FaxServer.Connect('');
FaxDocument := CoFaxDocument.Create;
FaxDocument.Body := 'd:\Document.pdf';
FaxDocument.DocumentName := 'Document name';
FaxDocument.Recipients.Add('+1 (425) 555-4567', 'Bill');
FaxDocument.Sender.Name := 'Bob';
FaxDocument.Sender.BillingCode := '23A54';
FaxDocument.Sender.Department := 'Accts Payable';
FaxDocument.Sender.FaxNumber := '+972 (4) 555-9070';
JobIDs := FaxDocument.ConnectedSubmit(FaxServer);

for I := VarArrayLowBound(JobIDs, 1) to VarArrayHighBound(JobIDs, 1) do
ShowMessage('Job ID: ' + VarArrayGet(JobIDs, [I]));
except
on E: EOleSysError do
ShowMessage(
Format('Sending of the fax failed! %s [%d]', [E.Message, E.ErrorCode])
);
end;
end;

或者没有类型库的情况下相同:

procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
JobIDs: OleVariant;
FaxServer: OleVariant;
FaxDocument: OleVariant;
begin
try
FaxServer := CreateOleObject('FaxComEx.FaxServer');
FaxServer.Connect('');
FaxDocument := CreateOleObject('FaxComEx.FaxDocument');
FaxDocument.Body := 'd:\Document.pdf';
FaxDocument.DocumentName := 'Document name';
FaxDocument.Recipients.Add('+1 (425) 555-4567', 'Bill');
FaxDocument.Sender.Name := 'Bob';
FaxDocument.Sender.BillingCode := '23A54';
FaxDocument.Sender.Department := 'Accts Payable';
FaxDocument.Sender.FaxNumber := '+972 (4) 555-9070';
JobIDs := FaxDocument.ConnectedSubmit(FaxServer);

for I := VarArrayLowBound(JobIDs, 1) to VarArrayHighBound(JobIDs, 1) do
ShowMessage('Job ID: ' + VarArrayGet(JobIDs, [I]));
except
on E: EOleSysError do
ShowMessage(
Format('Sending of the fax failed! %s [%d]', [E.Message, E.ErrorCode])
);
end;
end;

关于Delphi 到 Windows 传真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15052862/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com