4

I'm trying to send faxes through RightFax COM API Library:

  RFCOMAPILib.FaxServer server = new RFCOMAPILib.FaxServer();
  server.ServerName = "xxx";
  server.Protocol = CommunicationProtocolType.cpTCPIP;
  server.UseNTAuthentication = BoolType.True;

  // Error happens here
  server.OpenServer(); 

  RFCOMAPILib.Fax fax = (RFCOMAPILib.Fax)server.get_CreateObject(RFCOMAPILib.CreateObjectType.coFax);

  fax.ToName = "Batman";
  fax.ToFaxNumber = "23434484";
  fax.FromFaxNumber = "78678676";
  fax.FromName = "Robin";
  fax.Send();

I have registered the DLL file rfcomapi.dll:

C:\Program Files\RightFAX> RegSvr32 rfcomapi.dll     

Unfortunately, when running this code, I get the following error;

Unhandled Exception: system.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

I'm using version 9.4.0.0 of RightFax.

How do I fix this problem?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Intrigue
  • 672
  • 6
  • 15
  • At which line of code do you get that error? it's not something in your code. Managed code doesn't throw (or even allow) errors like that, not without extra work anyway. Btw, just noticed this line of code: fax.FromFaxNumber = fax.ToFaxNumber; That looks like it could potentially cause an API error. – Paul Sasik Dec 17 '10 at 04:35
  • Thanks Paul. I'll clarify my question. I get the error before that line, I get it when making the call to either OpenServer() or if I remove that line I get it @ server.get_CreateObject(--) – Intrigue Dec 17 '10 at 04:41
  • have you got other supporting dlls (RFWin32.dll, Rfi32rpc.ndr, and Rfi32smb.ndr) along with rfcomapi.dll? – VinayC Dec 17 '10 at 06:55
  • @VinayC - Thanks for your comments but yes I do, I was able to register the dll no problem. And I do have all those dlls in my computer, even I tried to copy them to the bin bolder of my little exe still didn't work. – Intrigue Dec 18 '10 at 00:45

2 Answers2

1

Your code itself is perfect. I can run it with my 9.4 RightFax without any problem. You may want to check with your authorization to make sure you account is full authorized in the server.

ITUtopia
  • 11
  • 2
  • Thanks mate. I been wondering for a while whether the credentials I have been given are consistant with what is actually configured in the server. I sent an email to the admin asking for clarification on this. Cheers. – Intrigue Dec 18 '10 at 00:47
1

The problem was the server name was incorrect, since we couldn't resolve that name in our network. I pinged the server and I got nothing, however I got the IP address of it and it worked fine!

Always ping the server with RightFax! The error messages you are going to get are not very descriptive!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Intrigue
  • 672
  • 6
  • 15