Click here to Skip to main content
Licence 
First Posted 16 Sep 2004
Views 108,797
Downloads 4,124
Bookmarked 40 times

Faxing with XP and C#

By Leon v Wyk | 16 Sep 2004 | Unedited contribution
Send faxes with C# using Win 2k or XP
14 votes, 50.0%
1
3 votes, 10.7%
2

3
3 votes, 10.7%
4
8 votes, 28.6%
5
2.04/5 - 28 votes
μ 2.09, σa 3.20 [?]

Sample Image - Fax-XP-ing.gif

Introduction

This code can be used to send Faxes using Windows XP, 2000 or Above. I have included a bitmap image in the demo that will be faxed to a recipient. You can make your own bitmap using System.Drawing class, save it to disk and then reference it and send it to a fax number. All you need is a Modem, windows fax service which comes with XP and a telephone line and you are on you way. I understand that there might be some issues with limited User rights but have not yet tested it, I was only using my Administator Account when testing this. Anyway, all you might need to do is add a reference to the "faxcom 1.0 Libary" and you are set. Your feed back is welcome and I will keep track on any problems.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Leon v Wyk

Software Developer (Senior)
Being IT Solutions
South Africa South Africa

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 4 PinmemberWilliam Croft12:05 24 Feb '11  
GeneralMy vote of 1 PinmemberShute31218:47 30 Aug '09  
QuestionFax Application in Windows server 2003 and 2008.. this one is just in xp and 2k rite?? PinmemberAmitsglja0:51 4 Aug '09  
QuestionIs there license issue? Pinmembersan_geit1:04 3 Jul '09  
QuestionHow can we send a multipage tiff file? Pinmembersamwiz19:12 25 Apr '09  
AnswerRe: How can we send a multipage tiff file? PinmemberLeon v Wyk9:06 30 Apr '09  
QuestionException from HRESULT:0x8007000D PinmemberSedArash21:52 10 May '08  
Hello,
I try to get the code below to work.
If I use test.tif it works just fine but all other extensions (pdf, txt, jpg
and so on) failing with "The data is invalid Exception from HRESULT:
0x8007000D".
 
I checked if the default setting for the extensions are correct and they are
assigned to notepad (txt) and acrobat reader (pdf) and Windows Picture and
Fax Viewer for (jpg).
I run Filemon and Regmon to see if there is an permission problem during the
click event but everything seems fine.
After the Error I have 2 events in my server logs.
Event ID 11
Document 4, 1C8673290FA2F - Notepad owned by NETWORK SERVICE was paused on
Fax.
Event ID 13
Document 4, 1C8673290FA2F - Notepad owned by NETWORK SERVICE was deleted on
Fax.
 

any suggestions what's wrong?
 

Regards
Anthony
 

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
 

Try
Dim faxserver As FAXCOMLib.FaxServer
Dim faxdoc As FAXCOMLib.FaxDoc
 

faxserver = New FAXCOMLib.FaxServerClass
faxserver.Connect("")
faxdoc =
faxserver.CreateDocument("c:\inetpub\collecta\temp\test.tif") 'if ichange
the file to test.tif it works
 

faxdoc.RecipientName = "receiver"
faxdoc.FaxNumber = "2106741826"
faxdoc.DisplayName = "test"
faxdoc.Send()
 

faxserver.Disconnect()
 

Catch ex As Exception
Response.Write(ex.Message)
End Try
 

Error:
The data is invalid. (Exception from HRESULT: 0x8007000D)
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
 

Exception Details: System.Runtime.InteropServices.COMException: The data is
invalid. (Exception from HRESULT: 0x8007000D)
 

Source Error:
 

Line 41: faxdoc.FaxNumber = "2106741826"
Line 42: faxdoc.DisplayName = "test"
Line 43: faxdoc.Send() (here the error occours)
Line 44:
Line 45: faxserver.Disconnect()
 

Source File: C:\Inetpub\collecta\Default.aspx.vb Line: 43
 

Stack Trace:
 

[COMException (0x8007000d): The data is invalid. (Exception from HRESULT:
0x8007000D)]
FAXCOMLib.IFaxDoc.Send() +0
collecta_Default.Button1_Click(Object sender, EventArgs e) in
C:\Inetpub\collecta\Default.aspx.vb:43
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
+107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaiseP­ostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
 
Don't Worry ! Be Happy !
SedArash

AnswerRe: Exception from HRESULT:0x8007000D PinmemberLeon v Wyk0:53 11 May '08  
GeneralRe: Exception from HRESULT:0x8007000D PinmemberSedArash2:23 11 May '08  
GeneralRe: Exception from HRESULT:0x8007000D PinmembersSupergirl5:17 15 Aug '08  
GeneralRe: Exception from HRESULT:0x8007000D PinmemberLeon v Wyk5:31 15 Aug '08  
GeneralRe: Exception from HRESULT:0x8007000D PinmembersSupergirl6:03 15 Aug '08  
GeneralRe: Exception from HRESULT:0x8007000D Pinmemberqiusongze0:40 6 Oct '08  
GeneralThe system can not find the file specified PinmemberZapss21:36 27 Jan '08  
GeneralFile Name + Fax Information Pinmembers3rro5:16 25 Sep '07  
GeneralRe: File Name + Fax Information PinmemberLeon v Wyk7:26 25 Sep '07  
GeneralRe: File Name + Fax Information Pinmembers3rro4:54 26 Sep '07  
GeneralUnknown Exceptional error Pinmembermast4283:51 23 Jul '07  
GeneralRe: Unknown Exceptional error Pinmembermast4284:30 23 Jul '07  
GeneralProblem accessing FAXCOM from other service PinmemberLAcike@sk6:20 28 Jun '07  
GeneralRe: Problem accessing FAXCOM from other service PinmemberLeon v Wyk10:19 28 Jun '07  
GeneralRe: Problem accessing FAXCOM from other service PinmemberLAcike@sk23:28 28 Jun '07  
GeneralRe: Problem accessing FAXCOM from other service PinmemberMember 216916020:20 20 Jun '08  
GeneralSending FAX using C#.net FAXCOMLib -The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8) PinmemberMember 216916020:22 20 Jun '08  
GeneralRe: Sending FAX using C#.net FAXCOMLib -The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8) PinmemberLeon v Wyk4:55 21 Jun '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120210.1 | Last Updated 16 Sep 2004
Article Copyright 2004 by Leon v Wyk
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid