Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 4 - Programmatically Controlling Windows Fax S...
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

Programmatically Controlling Windows Fax Services Using VB.net
By: Luke Niland
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2007-07-16

    Table of Contents:
  • Programmatically Controlling Windows Fax Services Using VB.net
  • Setting Up the Fax Server
  • Starting to Write the Application
  • Connecting to the Fax Server

  • 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

    Free Web 2.0 Code Generator! Generate data entry 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!

    Programmatically Controlling Windows Fax Services Using VB.net - Connecting to the Fax Server
    (Page 4 of 4 )

    As a test the first thing we will do is make sure we can connect to the fax server. This is very simple and can be achieved with just a few lines of code. Put a button on your form, and in the click event of the button type the following code. Each part is discussed underneath:

     Dim objFaxServer As New FAXCOMEXLib.FaxServer

     Dim objFaxOutgoingQueue As FAXCOMEXLib.FaxOutgoingQueue

      

           Try

                'Connect to the fax server.

                objFaxServer.Connect("srv-fax1")

     

                'Create the outgoing queue

                  objFaxOutgoingQueue = objFaxServer.Folders.OutgoingQueue

               

                'Ensure that the queue is not blocked or paused

                objFaxOutgoingQueue.Blocked = False

                objFaxOutgoingQueue.Paused = False

     

                'Set the number of retries

                objFaxOutgoingQueue.Retries = 3

                'Set the retry delay no of minutes

                objFaxOutgoingQueue.RetryDelay = 1

     

                'save the prefs

                objFaxOutgoingQueue.Save()

     

                Msgbox("Fax Settings Saved")

     

            Catch ex As Exception

                  Msgbox("Fax Error" & vbnewline & ex.message)

                Exit Function

            End Try

     

    The first two lines of code are variables that hold the connections to the server, and the outgoing queue properties. Both types live in the FAXCOMEXLib, as does everything else we use when talking to and configuring the server.

    We enclose the whole block of code in a Try Catch block, so we can handle any exceptions gracefully. The first line within the Try is connecting to the fax server, using the objFaxServer variable's Connect method. You just need to give it the name or the IP address of the server. Here it is hard coded but in the real world you would probably put the server name in a config file, or look it up directly.

    Once we have a connection, we can start to set the outgoing queue options. The next section of code sets our objFaxOutgoingQueue variable to be the current Outgoing queue of the server (basically, the variable now contains the current settings on the outgoing queue). Then we make sure the outgoing queue is ready to send out jobs by telling it not to be blocked, or paused. Then, we set the number of retries for the job (in this case three) and how long in minutes to wait before each retry (in this case one).

    We then call the Save method of the queue variable to write out new settings down to the server. If you don't call the Save method, none of the setting we have specified will change so it's very important to remember to do this. The rest of the code just pops up a message box, and closes the Try/Catch.

    If all has gone well, at this point when you run the code you should be given a message box telling you the new settings have been saved. However, if an error has occurred somewhere you will get a message saying 'Fax Error' along with a description of the error.

    As this code is not doing much apart from really testing connectivity between you and the service, the error is probably going to be something involving the name of the server being wrong (in the objFaxServer.Connect("srv-fax1") line), or possibly a security issue. The error message normally gives you a good indication of what has happened.

    If all has gone well, you are now ready to start sending jobs to the server and getting its current load and jobs. This is covered in part two of the article, so stay tuned!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Hi,Hope you find this article interesting, any comments or suggestions leave...
       · We have just started testing the Windows fax servie on Windows 2003 server. The...
     

    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...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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