Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 3 - Finishing the Client for an Internet Acces...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
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? 
DELPHI-KYLIX

Finishing the Client for an Internet Access Control Application
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-10-06

    Table of Contents:
  • Finishing the Client for an Internet Access Control Application
  • Check the ini file
  • Code Explained
  • The Timer Window

  • 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


    Finishing the Client for an Internet Access Control Application - Code Explained


    (Page 3 of 4 )

    The code is substantial, so we are only going to look at a few important functions and procedures. Most of the other procedures are easy to understand and also commented for easy reading.

    The first part of the code declares four functions. Here they are in order:

    TimedShutDown(Computer: string; Msg: string; Time: Word; Force: Boolean; Reboot: Boolean): Boolean; :

    This first function is responsible for implementing the shutdown command. It will be called when a staff member clicks on the shutdown button. I've tested this function on WinXP and Win2000; I didn't get any problems on either system. 

    The first argument that it takes is the name of the workstation that you want to shut down. Then it takes a text message that you want displayed on the shut down dialog box and since it is a timed shutdown, you need to specify the time in seconds next (in this case I've put in 30, but you may want to reduce or increase this to suit). The last two arguments are of type Boolean; both are set to true. The advantage of this function is that it centralizes control over the workstations.

    FuncAvail(dllName, funcName: string; var p: pointer): boolean;:

    This function is responsible for blocking keyboard and mouse access when the workstation is first switched on. How long it will block access is determined by a separate timer.

    ParseString(s : string; var Token1,Token2,Token3: string) :

    boolean;:

    You should be familiar with this function by now. It is responsible for breaking down server communication into three parts separating the command, action and any other message.

    GetComputerName:string;

    The GetComputerName function simply retrieves the name of the workstation. This is very important because the client application will try to connect to the server using this name; if it is not able to retrieve the name and then tries to connect to the server, it will be rejected.

    The Message Synchronization Functions

    These functions are responsible for ensuring smooth communication with the server and also ensure that messages from the server do not get "lost." Here I will discuss some of the more important ones, starting with the DoSynchronize ; procedure. 

    The DoSynchronize; procedure is responsible for capturing and parsing all server communication. It receives three commands from the server: shutdown, lockstation and activate. Each of these will have further information attached to them. For example the activate command will come from the server in the following format:


    activate:workstationname@10


    This will be broken into three parts by the parse() procedure and then fed to the appropriate function for execution.

    The ReadingThread code as listed below is responsible for reading all the communication from the server and then feeding it to the DoSynchronize; procedure.

    procedure TReadingThread.Execute;

    begin

    while not Terminated and FConn.Connected do

    begin

    TLog.AddMsg(FConn.IOHandler.ReadLn);

    end;

    end;


    There are a few things that you need to do before using this application.

    • First, remove or comment out the btConnect procedure, and uncomment the FormCreate procedure. You need to do this because, when the application is first started, it has to connect to the server using the FormaCreate procedure and not the btConnect procedure, which I've been using for debugging purposes.

    • Set the path to where your ads will be located BEFORE starting the application. Simply open up the settings.ini file and then change the path. Be sure to use the same format as the example in the file.

    • Remove the oneClick procedure from the code.

    More Delphi-Kylix Articles
    More By David Web


     

    DELPHI-KYLIX ARTICLES

    - Loading an XML Document into the DOM
    - Delphi Wrapper Classes and XML
    - Delphi and the DOM
    - Delphi and XML
    - Internet Access: Client Service
    - Finishing the Client for an Internet Access ...
    - The Client for an Internet Access Control Ap...
    - User Management for an Internet Access Contr...
    - Important Procedures for an Internet Access ...
    - Server Code for an Internet Access Control A...
    - Constructing the Interface for an Internet A...
    - Building a Server Application for an Interne...
    - Building an Internet Access Control Applicat...
    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...







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