| In case that you need to develop auto logon application based on Windows operating system. You need to access windows registry.
Refer below Delphi based example. (autologon.dpr) // Programmed 31 Dec 2010 by Chunun Kang(kurapa@kurapa.com)
//
program autologon;
{$APPTYPE CONSOLE}
uses
SysUtils, Registry, Windows;
var
i: integer;
b: boolean;
Reg: TRegistry;
begin
try
b := false;
Reg := TRegistry.Create;
if (Reg<>nil) then
begin
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey( ‘SOFTWAREMicrosoftWindows NTCurrentVersionWinlogon’, False);
for i := 1 to ParamCount do
begin
if ParamStr(i)=’-username’ then
begin
Reg.WriteString( ‘DefaultUserName’, ParamStr(i+1));
b := true;
end else if ParamStr(i)=’-password’ then
begin
Reg.WriteString( ‘DefaultUserPassword’, ParamStr(i+1));
b := true;
end else if ParamStr(i)=’-domain’ then
begin
Reg.WriteString( ‘DefaultDomainName’, ParamStr(i+1));
b := true;
end else if ParamStr(i)=’-autologon’ then
begin
Reg.WriteString( ‘AutoAdminLogon’, ParamStr(i+1));
b := true;
end;
end;
if (b=false) then
begin
// information registration mode such as ID, Password, and Domain
WriteLn( ‘Autologon 1.0 Copyright 2010 Chunun Kang(kurapa@kurapa.com) 31 Dec 2010′);
WriteLn( ‘Usage: autologon - - ….’);
WriteLn( ”);
WriteLn( ‘’);
WriteLn( ‘ username Default User Name’);
WriteLn( ‘ password Default User Password’);
WriteLn( ‘ domain Default Domain Name’);
WriteLn( ‘ autologon 0 = no logon, 1 = auto logon’);
WriteLn( ”);
WriteLn( ‘example) autologon -username super_user -password my_password -autologon 1′);
end;
end;
except
on E:Exception do
Writeln(E.Classname, ‘: ‘, E.Message);
end;
end.
If you want to compile above sample code, just copy & paste as autologon.dpr and click it if you have Delphi. |