2013-02-24 157 views
4

任何人都知道如何發送傳真與Windows 8傳真真正的德爾斐..我的意思是我需要啓動Windows傳真號碼和pdf附件。 關於這個的任何教程? thnx。德爾福到Windows傳真

回答

7

例如,您可以使用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; 
+0

難以置信。應該被固定。謝謝你gazillion次。 – Sardukar 2013-02-25 00:33:01

+0

不客氣! – TLama 2013-02-25 00:34:51

+0

只是還有一個問題..我得到一個傳真調制解調器來測試腳本如何檢查調制解調器是否存在? – Sardukar 2013-02-26 00:02:51