BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sending a FAX via the Windows FAX Console

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Bill Bream
Guest





PostPosted: Thu Apr 12, 2007 4:17 am    Post subject: Sending a FAX via the Windows FAX Console Reply with quote



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);
}
Back to top
Bob Gonder
Guest





PostPosted: Thu Apr 12, 2007 8:10 am    Post subject: Re: Sending a FAX via the Windows FAX Console Reply with quote



Bill Bream wrote:

Quote:
I'm getting a "parameter incorrect" message. Can you help me out?

You didn't say which line gives that error.

Quote:
if(!FaxConnectFaxServerPtr(pszServerName, &fxHandle))
if( ! FaxConnectFaxServerPtr( NULL, &fxHandle ) )


Quote:
if(!FaxCompleteJobParamsPtr(&pfxParam, &pcpInfo ))

pcpInfo = NULL;

You didn't free pcpInfo.
You didn't fill in the recipient info in the pfxParam.

Quote:
const String TempFileName =
"c:\\Bill\\faxserver.doc";
// Try to send
if(FaxSendDocumentPtr(fxHandle, TempFileName.c_str(), pfxParam, pcpInfo,
&dwJobId))
if( FaxSendDocumentPtr( fxHandle, "c:\\Bill\\faxserver.doc",

pfxParam, NULL, &dwJobId ) )

Quote:
FaxFreeBufferPtr(pfxParam);
FaxFreeBufferPtr(pcpInfo);
FaxClosePtr(fxHandle);
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.