DHNews
February 24th 04, 09:09 PM
I've found what appears to be a bug in the FaxDocument.ConnectedSubmit
function of FAXCOMEXLib in Windows XP.
Description:
ConnectedSubmit returns the fax job id as a string. In Windows XP, the job
id is a number in base10 format. This is apparently a bug in XP, because the
OnOutgoingJobChanged event handlers return the same number in base16 format.
ConnectedSubmit in Windows 2003 Server correctly returns the number in
base16 format. This causes a problem on XP when trying to match a job id
from ConnectedSubmit with a job id in OnOutgoingJobChanged.
Workaround:
To work around the XP bug, attempt to convert the job id number from a
base10 string to a 64 bit integer. If the conversion succeeds, convert it
back to a base16 string to match the event handlers. If the conversion
fails, assume the number is already base16 and keep it as is. (This
workaround could potentially fail because a base16 number can also be a
valid base10 number, but I think this is fairly unlikely because the job ids
are very large numbers. It might be better to check for the OS version, but
I don't have the resources to test all service packs and don't know if the
bug will be fixed in a future service pack or patch.)
Here's some C# code implementing the work-around:
string[] jobIds = (string[])objFaxDocument.ConnectedSubmit(objFaxServer);
string hexJobId;
try {
Int64 i = Convert.ToInt64(jobIds[0]);
//Match event handler format: hex number; lowercase;
// no leading zeroes; no "0x" or other prefix
hexJobId = i.ToString("x");
}
catch {
hexJobId = jobIds[0];
}
function of FAXCOMEXLib in Windows XP.
Description:
ConnectedSubmit returns the fax job id as a string. In Windows XP, the job
id is a number in base10 format. This is apparently a bug in XP, because the
OnOutgoingJobChanged event handlers return the same number in base16 format.
ConnectedSubmit in Windows 2003 Server correctly returns the number in
base16 format. This causes a problem on XP when trying to match a job id
from ConnectedSubmit with a job id in OnOutgoingJobChanged.
Workaround:
To work around the XP bug, attempt to convert the job id number from a
base10 string to a 64 bit integer. If the conversion succeeds, convert it
back to a base16 string to match the event handlers. If the conversion
fails, assume the number is already base16 and keep it as is. (This
workaround could potentially fail because a base16 number can also be a
valid base10 number, but I think this is fairly unlikely because the job ids
are very large numbers. It might be better to check for the OS version, but
I don't have the resources to test all service packs and don't know if the
bug will be fixed in a future service pack or patch.)
Here's some C# code implementing the work-around:
string[] jobIds = (string[])objFaxDocument.ConnectedSubmit(objFaxServer);
string hexJobId;
try {
Int64 i = Convert.ToInt64(jobIds[0]);
//Match event handler format: hex number; lowercase;
// no leading zeroes; no "0x" or other prefix
hexJobId = i.ToString("x");
}
catch {
hexJobId = jobIds[0];
}