3

We're currently using RightFax v9.3.2.89 with the rfcomlib API. Currently, we simply installed RightFax on everyone's computer as the application generating these faxes is on the desktop. Since we're moving to a web solution we will be only installing RightFax on the server. Issue with this is that the users won't be able to see if faxes are successfully sent. Looking at the API I see that I can do something like this:

faxServer.Events.WatchCompleteEvents = BoolType.True;
faxServer.OnCompleteEvent += faxServer_OnCompleteEvent;

The problem is that when I subscribe to watch for completed events I get

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Browsing the web I can see that this error can spring up from a million sources. It's odd because I have administrative rights on my computer.

Any ideas?

Unfortunately, the RightFax site is useless and there's little to no resources available.

Nosila
  • 540
  • 7
  • 20
  • 1
    This looks like a DCOM configuration error. My main suggestion would be to poll for status every 5-10 seconds rather than subscribing to events, as it will be more robust in the face of dodgy networks. – Ben Mar 14 '12 at 14:04
  • Woah. That is *so* much easier. I can simply fetch the fax sent by its handle and see what the `StatusDescription` is. If you post your comment as an answer I will gladly accept it. Thank you. – Nosila Mar 14 '12 at 16:01

2 Answers2

3

I noticed that when using the above method from Ben the status description never updates. The below example will sleep forever showing a status of "Waiting for Conversion" even though in FaxUtil the fax was clearly sent and has a status of "OK".

fax.Send();

while (fax.StatusDescription != "OK")
{
    Console.WriteLine("Polling fax handle " + fax.Handle.ToString() 
                   + " for status. Found: " + fax.StatusDescription);
    Thread.Sleep(5000);
}

I will second that the RightFax API has no documentation and is tough to work with. I hope this helps the original poster.

aphexddb
  • 76
  • 1
  • 5
0

Polling for fax.StatusDescription would put the program in an infinite loop. What you need to do is to repeatedly poll for the fax object in question. The following example grabs all fax objects within a particular folder, identifies the one fax object you need and queries the object's StatusDescription.

string status = "";
string description = "";
int handle = fax.Handle; // this identifies the fax object you're polling for
while (status != "fsDoneOK") // keep polling fax object until status is "OK"
{    
    foreach (Fax obj_fax in obj_user.Folders["Main"].Faxes) // look in the "Main" folder for fax objects
    {
        if (handle == obj_fax.Handle) // check to see if this object is yours
        {
            status = obj_fax.FaxStatus.ToString();
            description = obj_fax.StatusDescription;
            System.Diagnostics.Debug.WriteLine("Fax Status: " + obj_fax.StatusDescription);
        }
        if (status == "fsDoneError" || status == "fsError") // check for fax error
            break;
    }
    if (status == "fsDoneError" || status == "fsError") // check for fax error
        break;  
    Thread.Sleep(3000); // sleep for 3 seconds and then poll again
}