Home arrow Delphi-Kylix arrow Page 4 - The Client for an Internet Access Control Application
DELPHI-KYLIX

The Client for an Internet Access Control Application


Recently we finished a series covering the server side for an Internet access control application; now we're ready to take on the client. The client application is what the Internet users will see shortly before a workstation is activated or when a session is completed. It is responsible for both time and user access management as you will see in the rest of the series. Crucially, it is also responsible for processing all communication between itself and the server.

Author Info:
By: David Web
Rating: 5 stars5 stars5 stars5 stars5 stars / 6
September 29, 2008
TABLE OF CONTENTS:
  1. · The Client for an Internet Access Control Application
  2. · Small and Main Window
  3. · Disable Mouse and Keyboard Access
  4. · Retrieving the Workstation Name

print this article
SEARCH DEVARTICLES

The Client for an Internet Access Control Application - Retrieving the Workstation Name
(Page 4 of 4 )


The function below retrieves the computer or workstation name, which is then saved and sent to the server when connecting:


//********computername

function TForm1.GetComputerName: string;

var

buffer: array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char;

Size: Cardinal;

begin

Size := MAX_COMPUTERNAME_LENGTH + 1;

Windows.GetComputerName(@buffer, Size);

Result := StrPas(buffer);

end;

//*********end comp name function

The message synchronization functions have already been explained and should be easy to understand when looking through the code. The Dosychronize procedure is where the messages from the server are analyzed and processed. The server will send one of three commands, which this procedure needs to break down and execute:

//****** message synchronization functions

constructor TLog.Create(const AMsg: String);

begin

FMsg := AMsg;

inherited Create;

end;


procedure TLog.DoSynchronize;

var

cmd,mins,wstation:string;

begin

parsestring(FMsg,cmd,wstation,mins);

if cmd = 'activate' then begin

//remove screenblock

form1.Visible:=false;

form1.setoff:=true;

form2.times:=strtoint(mins);

form2.label1.caption:=mins;

form2.show;

end

else

if cmd='shutdown' then

begin

//initiate shut down

if not TimedShutDown(form1.GetComputerName, 'you have to shutdown', 30, true, true) then

ShowMessage('function failed...');

end

else

if cmd='lockstation' then

begin

//lock workstation

if not form1.Visible then

begin

form1.Visible:=true;

form1.setoff:=true;

end;

end;

end;


class procedure TLog.AddMsg(const AMsg: String);


begin


with Create(AMsg) do try

Synchronize;

finally

Free;

end;

end;

Conclusion

In the next article we will continue to explore some of the remaining procedures and functions.


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.

blog comments powered by Disqus
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...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials