VB, faxcom.dll

W

Ward Germonpé

Hi,

I intend to write a faxapplication in VB.
The targetted platform is W2K professional.

At some point, I want to check whether the fax was sent successfully or
not, and inform the user.

At MSDN I read that a queuestatus can have the following values :

Pending, In Progress are supported in W2K
All the other (much more interesting) ones like "Retries Exceeded", "No
Line", "Failed" are only supported in XP.


So how can I check whether a fax was succesfully sent or not in W2K ? If it
is not in the queue, was it successfull ?


thx

Ward
 
R

Raghavendra R [MSFT]

I think there is no straight-forward to achieve this using FaxCom. You can
also look at DeviceStatus member of FaxJob object.
Using Fax Service Client API, you can use the API FaxInitializeEventQueue to
register for fax events. This way you will receive a event with event ID
FEI_COMPLETED when the job is completed.

HTH.

--
Raghavendra R
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.'
 
R

Robert Freas

If your requirements prevent you from using the Extended FAXCOM API
(not available in Windows 2000 Pro) then you cannot use
FaxInitializeEventQueue() API to register for Fax events. Which
leaves you with two options:

1) Follow the "Sample.c" C++ example in the fax examples directory in
the Platform SDK which uses IOCompletionPorts() to poll for the status
on a fax. This method uses the c-type APIs, not the FaxCom COM API.
I tried to do this from .NET and hit a wall--so I went to option #2.

2) Use the base FaxCom COM API such that you Send(), then use the
returned jobID to look up the IJob object and then loop doing a
IJob.Refresh() and checking DeviceStatus/QueueStatus to determine
status of the fax job. It's really a tricky bit of logic because you
have to use both status properties to determine the real status... and
eventually, they go to "Unknown" status as you are polling, which
means you will have to constantly cache the last "known" status and
stop polling once you hit unknown, etc...

I am a bit disappointed that no one was able to answer my earlier
questions... I've posted 4 times in the past 2 weeks to no avail. :)

Good luck!

Rob
 
J

JasonL

Robert,

Just popped on to this group since I'm building an in-house fax app. I too
am stuck with Win2K and therefore the limited faxcom.dll.

I've had good success using option#1 (C# and P/Invoke). I looked over your
declarations in your post from 9/26/03. I don't claim to be an expert but I
did notice several things that might be the source of your difficulties.

It looks like you've already gone in another direction, but if you have any
questions or would like pointers in pursuing the .NET P/Invoke route post
your questions. I'll be glad to share what I've learned.


Robert Freas said:
If your requirements prevent you from using the Extended FAXCOM API
(not available in Windows 2000 Pro) then you cannot use
FaxInitializeEventQueue() API to register for Fax events. Which
leaves you with two options:

1) Follow the "Sample.c" C++ example in the fax examples directory in
the Platform SDK which uses IOCompletionPorts() to poll for the status
on a fax. This method uses the c-type APIs, not the FaxCom COM API.
I tried to do this from .NET and hit a wall--so I went to option #2.

2) Use the base FaxCom COM API such that you Send(), then use the
returned jobID to look up the IJob object and then loop doing a
IJob.Refresh() and checking DeviceStatus/QueueStatus to determine
status of the fax job. It's really a tricky bit of logic because you
have to use both status properties to determine the real status... and
eventually, they go to "Unknown" status as you are polling, which
means you will have to constantly cache the last "known" status and
stop polling once you hit unknown, etc...

I am a bit disappointed that no one was able to answer my earlier
questions... I've posted 4 times in the past 2 weeks to no avail. :)

Good luck!

Rob

"Raghavendra R [MSFT]" <[email protected]> wrote in message
I think there is no straight-forward to achieve this using FaxCom. You can
also look at DeviceStatus member of FaxJob object.
Using Fax Service Client API, you can use the API FaxInitializeEventQueue to
register for fax events. This way you will receive a event with event ID
FEI_COMPLETED when the job is completed.

HTH.

--
Raghavendra R
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.'

If
it
 
R

Robert Freas

Jason,

I did end up getting another solution working, but it is definitely
not ideal. Polling on an IFaxJob object is not at all reliable.
IFaxJob.Refresh() throws exceptions on Windows 2003, but usually does
not on Windows 2000/XP. Additionally, I am able to retrieve detailed
status information (busy, no dial tone, no answer, completed, etc.) on
Windows 2000/XP, but not Windows 2003. Anyway, at least it works...
but I might be tempted to go back and change it, given the time.

Anyway, cool, I'd be curious to see your extern declarations. I must
have had one of them incorrect. Everything worked up until a certain
API call--I forget which one and I just looked for that old scrapped
code I wrote and I cannot find it. :) You can email me or post here,
whichever.

Thanks,

Rob

JasonL said:
Robert,

Just popped on to this group since I'm building an in-house fax app. I too
am stuck with Win2K and therefore the limited faxcom.dll.

I've had good success using option#1 (C# and P/Invoke). I looked over your
declarations in your post from 9/26/03. I don't claim to be an expert but I
did notice several things that might be the source of your difficulties.

It looks like you've already gone in another direction, but if you have any
questions or would like pointers in pursuing the .NET P/Invoke route post
your questions. I'll be glad to share what I've learned.


Robert Freas said:
If your requirements prevent you from using the Extended FAXCOM API
(not available in Windows 2000 Pro) then you cannot use
FaxInitializeEventQueue() API to register for Fax events. Which
leaves you with two options:

1) Follow the "Sample.c" C++ example in the fax examples directory in
the Platform SDK which uses IOCompletionPorts() to poll for the status
on a fax. This method uses the c-type APIs, not the FaxCom COM API.
I tried to do this from .NET and hit a wall--so I went to option #2.

2) Use the base FaxCom COM API such that you Send(), then use the
returned jobID to look up the IJob object and then loop doing a
IJob.Refresh() and checking DeviceStatus/QueueStatus to determine
status of the fax job. It's really a tricky bit of logic because you
have to use both status properties to determine the real status... and
eventually, they go to "Unknown" status as you are polling, which
means you will have to constantly cache the last "known" status and
stop polling once you hit unknown, etc...

I am a bit disappointed that no one was able to answer my earlier
questions... I've posted 4 times in the past 2 weeks to no avail. :)

Good luck!

Rob

"Raghavendra R [MSFT]" <[email protected]> wrote in message
I think there is no straight-forward to achieve this using FaxCom. You can
also look at DeviceStatus member of FaxJob object.
Using Fax Service Client API, you can use the API FaxInitializeEventQueue to
register for fax events. This way you will receive a event with event ID
FEI_COMPLETED when the job is completed.

HTH.

--
Raghavendra R
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.'

Hi,

I intend to write a faxapplication in VB.
The targetted platform is W2K professional.

At some point, I want to check whether the fax was sent successfully or
not, and inform the user.

At MSDN I read that a queuestatus can have the following values :

Pending, In Progress are supported in W2K
All the other (much more interesting) ones like "Retries Exceeded", "No
Line", "Failed" are only supported in XP.


So how can I check whether a fax was succesfully sent or not in W2K ?
If
it
is not in the queue, was it successfull ?


thx

Ward
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top