By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,589 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,589 IT Pros & Developers. It's quick & easy.


P: n/a
Hi all
I want to send a fax with WebService in; I use this code to send a fax with FaxService in Windows XP

Dim FXServ As New FAXCOMLib.FaxServe
Dim FXDoc As FAXCOMLib.FaxDo
Dim iFaxJob As Intege


FXDoc = CType(FXServ.CreateDocument("C:\fax.doc"), FAXCOMLib.FaxDoc

FXDoc.FileName = "C:\fax.doc
FXDoc.FaxNumber = "005056
FXDoc.SenderName = "Fax Test
FXDoc.DisplayName = "Test

iFaxJob = FXDoc.Send(


This code works well in Windows Forms but in Web Forms or in a WebService don’t work. I try different configurations of security, put the code in another assembly and generate a Wrapper for the FAXComLib class as explained in;en-us;q303647 without any result

Anybody can help me? Thanks in advance


Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
I am having a similar problem with a Win32 Service (not WebService)...when I run application as stand-alone exe the fax sends fine using the same code you have above, however, when I attempt to run as a service the FXDoc.Send() line hangs indefinately. The same behaviour is seen using FXServer.ConnectedSubmit and FXServer.Commit...I suspect the problem is as follows: When you create a service (Windows or Web), you may include no UI, however, when you try to fax using any method described above you create an instance of Word (or WordPad, or Acrobat, or whatever, depends on document being printed)...since each of these apps have a UI (often you see "printing page X of Y to Fax" window, or the actual document load) I believe the faxing fails...

Sadly I have yet to find a workaround :-(
I am now attempting to fax directly to the FaxMachine's DC using FaxStartPrintJob (in winfax.dll), but am having vast problems converting the C types to VB...If anyone can help in this endevour it would be greatly appreciated...once I have this resolved I will post code snippet here.
Nov 20 '05 #2

P: n/a
Joan et all,
I was able to re-create your problem (if your service, indeed, appears to hang on the 'FXDoc.Send()' line of code
(NOTE: you can test this by putting debug lines before and after the line which print some message to an ASCII file. Please don't forget to close your debugging file BEFORE your 'FXDoc.Send()' line executes! You could also use the EventLog success-audit stuff). (Incidently, I do not believe your code (as listed) will work on Win2K machines, which is how this nightmare began for me)...Here's the ONLY work-around I could find (and I tried quite a few, see previous post):
[Note: Using MSFax from XP, and W2K disks]
I believe one needs to call FaxStartPrintJob API to obtain a Device Context for the faxing job (you also set routing info when you call this API). Once you have successfully called FaxStartPrintJob (non-zero return code), [then FaxPrintCoverPage] you may freely use GDI (and GDI+ I immagine) functionality to send your fax. I cannot seem to send an associated file via service at all (like your .doc file). I believe it has to do with the UI that the associated program uses, but I'm not certain (like Word or Wordpad, whichever handles your server's .doc's). Personally, I hated coding this, it was tedious, and much more code than I needed to send a fax while not running as a service (Win32 or Web). The ONLY benefit I see from the previously described code is it works on both XP and Win2K...If anyone has any alternatives please let us know!!

For additional information on Faxing directly to a device context (unfortunately only talks about C++, but works in VB.Net and VB6) see:
(also do not forget to call EndDoc AND DeleteDC NEVER freeDC!!)
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.