I have been investigating how to send faxes via windows. A client has some old VB code that uses Crystal Reports and FACSys (via DDE) to automate faxing but they are having some problems with the FACSys software. I will need faxing capabilities from the .NET software that I am writing at the moment too, so investigations are prudent.
I found the fax printer that installs by default on Win2k when you install a modem, and I like it. There is also a faxcom.dll that allows COM consumers to send files via it, allowing specification of the fax number etc in code. The problem is that according to this MSDN article this is only supported from the local machine for Win2k.
Since faxcom.dll is a COM component, I'm think I may be able to use DCOM to connect to it remotely, and then let it do its fax thing, but I'm not too sure about this, it has been over 2 years since I've touched DCOM and I'm a little rusty. I plan on looking into this today though.
What I'd really love to know, is how I can specify custom properties for a print driver via code. Don't really care what language, as long as I could expose my code via COM, VB6 would be ideal at this stage for easy integrating with the existing code. For example, if I wanted to print to a local printer, that was set up to print to the FILE port, when I sent something to this printer a dialog would pop-up asking me for the file location. How could I specify the file location via code, so that this process was automated? I'm sure there is a way, I just don't know what it is yet.
If I could do the specify file thing I mentioned above, then I assume I would then be able to use the shared fax capabilities in Win2k Small Business Server and setup network fax printers on the client, and then I could presumably use the same technique that was used to specify the file name for the FILE printer, to specify the Fax number, etc for the Fax printer.. anyway, should be fun figuring all this out.
John.
Any progress on this? I would like to collaborate with you on this if you are still in progress!!
Sorry Matt, didn't make much progress on this. As I recall you can't call faxcom via dcom, and I never did find an API for specifying custom parameters for the print drivers.
Printing has always been the bane of my existance... and it's been a fair while since I've written anything for managing printing now too.
I have an access program, with a lot of underlying vb code. I have a button that generates a report (invoice) and prints to the default printer, and when you pick the "shared fax" as the printer you get a nasty, cumbersome "send fax wizard" which is very time consuming. The loaded form has the fax number and customer name already queeried from the customers table. I would like to enter that information automatically with no cover page and eliminate 4 clicks of the mouse to cascading through the "send fax wizard".
I have researched a bit on the "Microsoft Outlook Programming Model" -- Microsoft KB article #301109!
By the way John, I appreciate you quick response from a forum of over two years old. I wasn't really expecting you to still be around!
Ah, yep. I remember this from last time I looked into this faxing business. There is actually an extra service that comes with SBS (small business server) that you can use to send faxes. But that won't help you, unless you have SBS..
The KB article [1] refers to the Shared Fax Client, which I guess is the name of the service that is available with SBS. I forget the details, but from what I remember it's only available with SBS. Exchange can do faxing too. As I recall the SBS stuff that I played with didn't require you to send emails, you were able to access the shared fax as a shared printer.. (not that would help solve your 'annoying dialog box' problem.. and, upon reflection, SBS is probably already what you're using given that you referred to the 'shared fax', in which case the KB article should have solved your problem..?)
So.. are you using SBS, or Exchange, or just the Win2k fax driver?
The other thing that you might consider is just using SendKeys to dodge the fax dialog.. :P ( do you know how to do that..? )
SendKeys is dodgy, because if the user does something silly, or something unexpected happens in the UI, (both of which are remarkably common) then you could have any number of problems. You could actually 'send keys' as windows messages to the real dialog (more stable, still dodgy) if you wanted to do some windows API stuff (which I guess you can do from VB).
I'm really not the best person to be asking about this faxing business though. The coolest fax system that I ever saw was implemented by a mate who ran a system that allowed you to email it (SMTP) a PDF document and it would forward the PDF as a fax, all done with Linux.
John.
[1] http://support.microsoft.com/?kbid=301109
By the way, if you're running your application on the computer that has the modem installed, then this [1] might help you.
John.
[1] https://www.jj5.net/blog-archive-2005/149.html
I am using SBS 2000, I don't know anything about send keys, but I will research it!
Thank you for the direction!
Install the Windows 2000 / 2003 fax service
put a reference to FaxCom.dll in your c# references. then just use this code:
FAXCOMLib.FaxServer faxServer = new FAXCOMLib.FaxServerClass();
faxServer.Connect(Environment.MachineName);
FAXCOMLib.FaxDoc faxDoc = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(FileName);
faxDoc.RecipientName = RecipientName;
faxDoc.FaxNumber = FaxNumber;
faxDoc.DisplayName = DocumentName;
int Response = faxDoc.Send();
faxServer.Disconnect();
Thats about it. I haven't looked into doing this with VBA or vb.net, or perl or anything else, but I'm sure it can be used quite easily.
http://www.dotnetspider.com/technology/kbpages/680.aspx
Hi Kent,
Thanks for your contribution.
Yep, that's the equivalent to this VB6 code [1] I posted earlier.
What I was really interested in (at the time that I wrote this, which was a long time ago) was how to get the same code to run on a machine that wasn't running the service.
It'd be easy enough to write my own fax service that wrapped this basic code though.
John.
[1] https://www.jj5.net/blog-archive-2005/149.html