Using MS Fax with Xbase++

C

Charles Freeman

MSFT gurus,

I am attempting to develop a simple interface to MS Fax (i.e. the "Local"
fax) from within the Xbase++ language, which is a 32 bit Windows
database-oriented language. Xbase has the ability to hook external DLLs
rather easily, but not the ability to call COM objects natively (until the
next release). Thus I need to use the Win32 interface methodology.

After a weekend of work I can successfully:

1) Link the DLL (I am linking Winfax.dll - is this right?)
2) Get a FaxServer handle with FaxConnectFaxServerA
3) Get a FaxPort structure with FaxEnumPortsA and extract a DeviceID
4) Use the DeviceID with FaxOpenPort and return a FaxPort handle
(I plan to use this handle to look at the progress and results of the
outgoing fax - not done yet)
5) Call the FaxSendDocumentA function with parameters as follows:

FaxSendDocumentA(hFaxHandle, cFileName, cFaxJobParam, CNULL, nFaxJobId )

.. However, this call returns the error:
ERROR_INVALID_DATA
According to the documentation for FaxSendDocument, this means that either
the filename I am trying to fax cannot be opened or the coverpage structure
is a problem. In my case I am using a NULL in the structure (0x00000000) for
the coverpage element, as the documentation says to do if I don't want a
coverpage.

My sample file that I am trying to fax is "C:\TEST\SAMPLE.TIF", a sample
two-page TIFF file in the correct fax resolution that I created for testnig
purposes. (I've also tried sending a TXT file with the same results). I'm
fully qualifying the path as you can see, and sending the zero-terminated
string as a string pointer to the function (based upon by other work
creating interfaces to Winsock this seems to be what an LPCTSTR means to
Xbase++.)

I'm pretty sure that my FAX_JOB_PARAM structure is correct, since in the
development phase leading up to this point it wasn't and the function gave
me an
ERROR_INVALID_PARAMETER
message instead.

Any ideas? Does FaxSendDocument not work with TIFF files?

I look for to your reply. This is the last little task before I can release
this particular program to my clients.

Charlie
 
R

Raghavendra R [MSFT]

Looking at the whole scenario I am not able to find anything obviously
wrong. By the way the mail was very detailed. The only thing I can suggest
is to try the same program in plain 'C' so we can get Xbase++ out of
picture.

The other reason (other than what you mentioned below) for this function to
fail with ERROR_INVALID_DATA is due to problem handling the body file. Do
you have a Fax Printer installed & shown in the Printers Folder? You can
also try a fax with a cover page & without a body. When you do this remember
to set the FAX_COVERPAGE_INFO.SizeOfStruct to sizeof(FAX_COVERPAGE_INFO).

Let us know what happens.

--
Raghavendra R
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
 
C

Charles Freeman

I figured it out, thanks. I'm still new at interfacing Xbase+ to the WinAPI.
In this case I was one "pointer" away from the right answer - I was sending
a pointer to a NULL, rather than a NULL itself, for the FAX_COVER_PAGE
structure parameter. All is working beautifully now.

Charlie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top