Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 2 - More on Controlling Windows Fax Services U...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

More on Controlling Windows Fax Services Using VB.Net
By: Luke Niland
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 6
    2007-07-25

    Table of Contents:
  • More on Controlling Windows Fax Services Using VB.Net
  • What is the Code Doing?
  • Submitting a Job to the Server
  • Explaining the Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    More on Controlling Windows Fax Services Using VB.Net - What is the Code Doing?


    (Page 2 of 4 )

    The first five lines are just our object and variable declarations. The first object (objFaxServer) is our actual connection to the fax server. As discussed in the first article, all the methods we need when controlling the fax services are in FAXCOMEXLib.

    Next, we have our activity object called objFaxActivity. This will let us ask the fax service about what active jobs it is currently handling. Our last object is collFaxDevices. This gives us the number of physical fax devices that the fax server is using. These are normally modems but could be ISDNs or others depending on your setup.

    The final declaration lines are just a variable we will use to keep track of the number of jobs and our streamwriter object so we can write the values out to a file.

    Next, we use our fax server object, and connect it to our fax server. In a production application you should enclose this statement in a Try/Catch in order to gracefully handle any exceptions, the main one here being that you can't see the server or don't have permissions to connect to it.

    Next we set the activity object we created to the server object. This will now allow us to query that server for activity, so the first thing we do after that is use the refresh method to get all the latest information.

    Using our newly created activity object, we then add together its QueuedMessages and OutgoingMessages and hold them in the count variable. This number will tell us how many jobs are currently being sent out from the server, and how many are waiting to be sent.

    We then set our devices object to be the number of devices on the server to which we have attached. Now that we have all the information available to us, we can write it out to our file.

    First of all we set our StreamWriter to create a new file (c:num_jobs.txt) and append text to it. Then, line by line we write out the current time, the number of modems, the total number of faxes being and waiting to be sent, the number of current outgoing jobs, the number of queued jobs and the number of incoming jobs.

    Run the application in Visual Studio, and hit the new button. If all has gone according to plan you should now have a file similar to this one at c:num_jobs.txt:

    Time: 11/07/2007 11:38:22

    Modems:4

    Total Faxes:1

    Outgoing: 1

    Queued: 0

    Incoming: 0

    While information like this might not be of too much use, you now should have all the code you need to get overall job information from the server.

    I have used this information in the past when load balancing more than one fax server. Before sending any new jobs I look at a file similar to this on all my fax servers, decide which one is the quietest and send my new job to that one.

    More Visual Basic.NET Articles
    More By Luke Niland


       · Hi,Thanks for this article, I have been trying for several days but I can...
       · Hi,That error does'nt ring any bells, but if you can post the chunk of code thats...
       · Hello,We are getting the same error when trying to attach the "Body" to the fax....
       · Hi, I have never been able to replicate this error. I assume you are getting it when...
       · When my vbs execute the line ConnectSubmit(FaxServer) each document is opened, any...
       · hi,i am trying to send multiple faxes automatically, but when i submit...
     

    VISUAL BASIC.NET ARTICLES

    - Clocks and Countdowns
    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 12 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek