Solved

FaxSendDocument API from Delphi

Posted on 2004-03-25
4
1,122 Views
Last Modified: 2013-11-13
Is there a way to call the FaxSendDocument and FaxStartFaxServer APIs from Delphi 6?

Thanks in advance!

A1t
0
Comment
Question by:A1ternity
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 500 total points
ID: 10685194
Hi..

first there is no Ip Called FaxStartFaxServer .

here is the convertion on the API fuctions of 3 basic Functions ( connecting ..Sending , and closing) ( at the end of the emssage)

But Also microsoft Advice us to use Faxserver Com Objects..

Faxserver has 3 sub Objects
                 FaxJobs, FaxPorts and FaxDoc objects.

How to  Send a Document with this objects
************* Fax sending with Com Objects *****************
Procedure ConnectAndSendFaxDocument
  var
        mFaxServer      : variant;
        mFaxDocument    : variant;
  begin
        mfaxserver :=CreateOleObject('FaxServer.FaxServer');
        mfaxServer.Connect('MyFaxserver');  // if this parameter is null then connect to localhost
        mFaxDocument:=mFaxServer.CreateDocument('Filename');
        mfaxDocument.FaxNumber:='5555555';
        mFaxDocument.Filename:='Filename';
        mfaxDocument.Send;
        mFaxServer.Disconnect;
        mFaxServer:=nil;
        mFaxDocument:=nil;
  end;


here is the link of microsoft help about Faxserver Com Object
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fax/faxlegacyvb_9tb3.asp


************** Unit Winfax *****************
unit winfax;
//  Object      : Winfax.dll WinAPI Functions
//  Author      : Non Zero ( Melih SARICA)
//  Date        : 26/04/2004
//  Status      : Not Fully Convereted

interface
uses windows;

 Type
   HCall                = Cardinal;
  _FAX_JOB_PARAM = record
        SizeOfStruct            : dword;        //structure size, in bytes
        RecipientNumber         : Pchar;        //pointer to recipient's fax number
        RecipientName           : Pchar;        //pointer to recipient's name
        Tsid                    : Pchar;        //pointer to transmitting station identifier
        SenderName              : Pchar;        //pointer to sender's name
        SenderCompany           : Pchar;        //pointer to sender's company
        SenderDept              : Pchar;        //pointer to sender's department
        BillingCode             : PChar;        //pointer to billing code
        ScheduleAction          : Dword;        //job scheduling action code
        ScheduleTime            : SYSTEMTIME;   //time to send fax
        DeliveryReportType      : dword;        //e-mail delivery report type
        DeliveryReportAddress   : Pchar;        //pointer to e-mail address
        DocumentName            : Pchar;        //pointer to document name to display
        CallHandle              : Hcall;        //reserved
        Reserved                : array [0..2] of byte;   //must be zero
  end;
  FAX_JOB_PARAM  = _FAX_JOB_PARAM;
  PFAX_JOB_PARAM = ^_FAX_JOB_PARAM;


 function FaxConnectFaxServer(
  MachineName   : Pchar;  // fax server name    ' null if localcomputer
  FaxHandle     : PHandle         // handle to the fax server
        ):longbool;safecall; external 'winfax.dll' name 'FaxConnectFaxServerA';

 function FaxClose(
  FaxHandle     :  THandle // fax handle to close
        ):longbool;safecall; external 'winfax.dll';

  function  FaxSendDocument(
  FaxHandle     : THandle;          // handle to the fax server
  FileName      : Pchar;            // file with data to transmit
  JobParams     : PFAX_JOB_PARAM;   // pointer to job information structure
  FAX_COVERPAGE_INFO : pointer ;    // Normally it must be a structure but i dont use it .. so it ll be nil in my codes
  FaxJobId      : PDWORD            // fax job identifier
        ):longbool;safecall; external 'winfax.dll';

implementation

end.
0
 

Author Comment

by:A1ternity
ID: 10687254
Actually I found out that the jedi project has translated winfax.h to delphi. So using this API is now pretty easy.
Still, here are your points!
0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10687667
Where are they ? where are they? :p

thnx
0
 

Author Comment

by:A1ternity
ID: 10687679
lol there you go :)

Thanks again!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exchange and Third Party application. 8 60
Visual xHarbour 1 77
Replace a tag with sed 2 43
Path to Python 9 48
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now