Article View: borland.public.cppbuilder.nativeapi
Article #2139Sending a FAX via the Windows FAX Console
From: Bill Bream
Date: Wed, 11 Apr 2007 23:17
Date: Wed, 11 Apr 2007 23:17
76 lines
2888 bytes
2888 bytes
Hello,
I'm trying to send a FAX using Windows FAX Console programmatically with "FaxSendDocument" in "winfax.dll". I'm getting a "parameter incorrect" message. Can you help me out? - What's wrong with my code? - Is there a better way? - Would you suggest using a 3rd party component? Thanks in advance for you answer. Here's the code:
void TfrmMain::FaxDocument()
{
HANDLE fxHandle;
PFAX_JOB_PARAM pfxParam;
PFAX_COVERPAGE_INFO pcpInfo;
DWORD dwJobId;
LPCTSTR pszServerName = NULL;
// POINTING to local machine right now:
// pszServerName =
//////////
// Connect to the fax server
FaxConnectFaxServerPtr =
(FAX_CONNECT_FAX_SERVER_A)GetProcAddress(FDllHandle, "FaxConnectFaxServerA");
if(FaxConnectFaxServerPtr)
{
if(!FaxConnectFaxServerPtr(pszServerName, &fxHandle))
{
ReportOSError();
ShowMessage("ERROR connecting to the FAX Server!");
return;
}
}
FaxClosePtr = (FAX_CLOSE)GetProcAddress(FDllHandle, "FaxClose");
// Prepare and allocate job params and cover page data
FaxCompleteJobParamsPtr =
(FAX_COMPLETE_JOB_PARAMS_A)GetProcAddress(FDllHandle, "FaxCompleteJobParamsA");
if(FaxCompleteJobParamsPtr)
{
if(!FaxCompleteJobParamsPtr(&pfxParam, &pcpInfo ))
{
ReportOSError();
if(FaxClosePtr)
FaxClosePtr(fxHandle);
return;
}
}
pcpInfo = NULL;
const String TempFileName =
"c:\\Bill\\faxserver.doc";
// Try to send
FaxSendDocumentPtr =
(FAX_SEND_DOCUMENT_A)GetProcAddress(FDllHandle, "FaxSendDocumentA");
if(FaxSendDocumentPtr)
{
if(FaxSendDocumentPtr(fxHandle, TempFileName.c_str(), pfxParam, pcpInfo,
&dwJobId))
ShowMessage("SendDoc succeeded");
else
{
ReportOSError();
ShowMessage("ERROR with FaxSendDocument!");
}
}
// Cleanup here:
FaxFreeBufferPtr = (FAX_FREE_BUFFER)GetProcAddress(FDllHandle, "FaxFreeBuffer");
if(FaxFreeBufferPtr)
FaxFreeBufferPtr(pfxParam);
if(pcpInfo && FaxFreeBufferPtr)
FaxFreeBufferPtr(pcpInfo);
if(FaxClosePtr)
FaxClosePtr(fxHandle);
}
Technical Details
Message-ID:
<461d5e63$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6de2227e34dc5f3a,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Bill Bream" <bb@insightmed.com> Sender: "Bill Bream" <bb@insightmed.com> Reply-To: "Bill Bream" <bb@insightmed.com> Subject: Sending a FAX via the Windows FAX Console Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 69.224.253.197 NNTP-Posting-Host: 207.105.83.66 Message-ID: <461d5e63$1@newsgroups.borland.com> Date: 11 Apr 2007 15:17:07 -0800 X-Trace: newsgroups.borland.com 1176329827 207.105.83.66 (11 Apr 2007 15:17:07 -0800) Lines: 76 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail