Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 2 - More on Controlling Windows Fax Services U...
Iron Speed
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
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 / 4
    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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    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


     

    VISUAL BASIC.NET ARTICLES

    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...
    - Programmatically Controlling Windows Fax Ser...
    - Focusing on Forms and Menus in Visual Basic
    - Manipulating Forms with the Windows Forms Li...
    - Basics of the Windows Forms Library
    - Forms, Controls, and Other Useful Objects
    - Implementing OOP to Develop Database Oriente...
    - Using Themes and Skins for Personalization w...
    - A Deeper Look at Personalization using Visua...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway