uses ShellApi;
...
ShellExecute(Handle, 'open', 'c:\Windows\system32\shutdown.exe', nil, nil, SW_SHOWNORMAL) ;
Replace these every slider sentences with your featured post descriptions.Go to Blogger edit html and find these sentences.Now replace these with your own descriptions.
Replace these every slider sentences with your featured post descriptions.Go to Blogger edit html and find these sentences.Now replace these with your own descriptions.
7:22 AM
iwan RFID
uses ShellApi;
...
ShellExecute(Handle, 'open', 'c:\Windows\system32\shutdown.exe', nil, nil, SW_SHOWNORMAL) ;
7:15 AM
iwan RFID
function GetIni(s,k: string; d: boolean; f: string=''): boolean; overload;
var
ini: TMemIniFile;
begin
Result := d;
if f = '' then
begin
ini := TMemIniFile.Create(lowercase(ChangeFileExt(ParamStr(0),'.ini')));
end
else
begin
if not FileExists(f) then Exit;
ini := TMemIniFile.Create(f);
end;
if ini.ReadString(s,k,'') = '' then
begin
ini.WriteBool(s,k,d);
ini.UpdateFile;
end;
Result := ini.ReadBool(s,k,d);
FreeAndNil(ini);
end;
function SetIni(s,k: string; d: boolean; f: string=''): boolean; overload;
var
ini: TMemIniFile;
begin
Result := d;
if f = '' then
begin
ini := TMemIniFile.Create(lowercase(ChangeFileExt(ParamStr(0),'.ini')));
end
else
begin
if not FileExists(f) then Exit;
ini := TMemIniFile.Create(f);
end;
ini.WriteBool(s,k,d);
ini.UpdateFile;
Result := ini.ReadBool(s,k,d);
FreeAndNil(ini);
end;
function GetIni(s,k: string; d: integer; f: string=''): integer; overload;
var
ini: TMemIniFile;
begin
Result := d;
if f = '' then
begin
ini := TMemIniFile.Create(lowercase(ChangeFileExt(ParamStr(0),'.ini')));
end
else
begin
if not FileExists(f) then Exit;
ini := TMemIniFile.Create(f);
end;
if ini.ReadString(s,k,'') = '' then
begin
ini.WriteInteger(s,k,d);
ini.UpdateFile;
end;
Result := ini.ReadInteger(s,k,d);
FreeAndNil(ini);
end;
function SetIni(s,k: string; d:integer; f: string=''): integer; overload;
var
ini: TMemIniFile;
begin
Result := d;
if f = '' then
begin
ini := TMemIniFile.Create(lowercase(ChangeFileExt(ParamStr(0),'.ini')));
end
else
begin
if not FileExists(f) then Exit;
ini := TMemIniFile.Create(f);
end;
ini.WriteInteger(s,k,d);
ini.UpdateFile;
Result := ini.ReadInteger(s,k,d);
FreeAndNil(ini);
end;
function GetIni(s,k: string; d: string; f: string=''): string; overload;
var
ini: TMemIniFile;
begin
Result := d;
if f = '' then
begin
ini := TMemIniFile.Create(lowercase(ChangeFileExt(ParamStr(0),'.ini')));
end
else
begin
if not FileExists(f) then Exit;
ini := TMemIniFile.Create(f);
end;
if ini.ReadString(s,k,'') = '' then
begin
ini.WriteString(s,k,d);
ini.UpdateFile;
end;
Result := ini.ReadString(s,k,d);
FreeAndNil(ini);
end;
function SetIni(s,k: string; d: string; f: string=''): string; overload;
var
ini: TMemIniFile;
begin
Result := d;
if f = '' then
begin
ini := TMemIniFile.Create(lowercase(ChangeFileExt(ParamStr(0),'.ini')));
end
else
begin
if not FileExists(f) then Exit;
ini := TMemIniFile.Create(f);
end;
ini.WriteString(s,k,d);
ini.UpdateFile;
Result := ini.ReadString(s,k,d);
FreeAndNil(ini);
end;
Source : http://www.delphidabbler.com/tips/59
7:14 AM
iwan RFID
procedure LogOff;
begin
ExitWindowsEx(EWX_LOGOFF, 0);
end;
7:13 AM
iwan RFID
unit SystemCriticalU;
interface
uses
Windows;
type
TSystemCritical = class
private
FIsCritical: Boolean;
procedure SetIsCritical(const Value: Boolean) ;
protected
procedure UpdateCritical(Value: Boolean) ; virtual;
public
constructor Create;
property IsCritical: Boolean read FIsCritical write SetIsCritical;
end;
var
SystemCritical: TSystemCritical;
implementation
{ TSystemCritical }
// REF: http://msdn.microsoft.com/en-us/library/aa373208.aspx
type
EXECUTION_STATE = DWORD;
const
ES_SYSTEM_REQUIRED = $00000001;
ES_DISPLAY_REQUIRED = $00000002;
ES_USER_PRESENT = $00000004;
ES_AWAYMODE_REQUIRED = $00000040;
ES_CONTINUOUS = $80000000;
KernelDLL = 'kernel32.dll';
{
SetThreadExecutionState Function
Enables an application to inform the system that it is in use,
thereby preventing the system from entering sleep or turning off the
display while the application is running.
}
procedure SetThreadExecutionState(ESFlags: EXECUTION_STATE);
stdcall; external kernel32 name 'SetThreadExecutionState';
constructor TSystemCritical.Create;
begin
inherited;
FIsCritical := False;
end;
procedure TSystemCritical.SetIsCritical(const Value: Boolean) ;
begin
if FIsCritical = Value then
Exit;
FIsCritical := Value;
UpdateCritical(FIsCritical);
end;
procedure TSystemCritical.UpdateCritical(Value: Boolean) ;
begin
if Value then
// Prevent the sleep idle time-out and Power off.
SetThreadExecutionState(ES_SYSTEM_REQUIRED or ES_CONTINUOUS)
else
// Clear EXECUTION_STATE flags to disable away mode and allow the
// system to idle to sleep normally.
SetThreadExecutionState(ES_CONTINUOUS);
end;
initialization
SystemCritical := TSystemCritical.Create;
finalization
SystemCritical.IsCritical := False;
SystemCritical.Free;
end.
SystemCritical.IsCritical = true;
try
// do critical operation here
// without going in to sleep or turning off the display
finally
SystemCritical.IsCritical = false;
end;
Source : http://www.delphidabbler.com/tips/127
7:11 AM
iwan RFID
uses
Windows;
...
procedure SetNumLockOn;
var
KeyState: TKeyBoardState;
begin
GetKeyboardState(KeyState);
if GetKeyState(VK_NUMLOCK) = 0 then begin
KeyState[VK_NUMLOCK] := 1;
SetKeyboardState(KeyState);
end;
end;
7:10 AM
iwan RFID
uses
Messages, Windows;
...
// Your main form's class
protected
procedure WMHotKey(var Message: TMessage); message WM_HOTKEY;
...
implementation
...
procedure TMainForm.WMHotKey(var Message: TMessage);
begin
// This example brings the application up front. Put your code here
Application.BringToFront;
end;
RegisterHotKey(Handle, 100000 { Any unused number}, MOD_CONTROL, VK_F7);
// When closing program
UnregisterHotKey(Handle, 100000);
Source : http://www.delphidabbler.com/tips/16
6:59 AM
iwan RFID
AutoScroll := False at least while being re-calculated. Also the font size for the form should be (probably) 12 for the font to be resized downwards for 800×600 – all controls should be set to ParentFont := True so they will resize. scrx / screenx = 1 so the form stays with original measurements. uses
math,windows;
const
screenx = 1280;
screeny = 768;
procedure tform1.autosizeall ;
var
scrx,scry, k:integer ;
ratio:double;
begin
scrx:= GetSystemMetrics(SM_CXSCREEN); {finds screen resolution x value}
scry:= (GetSystemMetrics(SM_CYSCREEN)); {finds screen resolution y value}
ratio:=min(scrx/screenx,scry/screeny);
{takes the smaller ratio and makes sure you dont make the window
too big for the screen}
scaleby(trunc(ratio*100),100);
{scales all controls and attempts to place them in the correct position}
{to centre the form on the screen}
form1.Left:=centreleft(form1.width);
form1.Top:=centretop(form1.Height) ;
end;
function centreleft(fw:integer):integer;
{calculates the form.left}
var
smcx:integer;
begin
smcx:=GetSystemMetrics(SM_CXSCREEN);
centreleft:=(smcx-fw) div 2;
end;
function centretop(fh:integer):integer;
{calculates the form.top}
var
smcy:integer;
begin
smcy:=GetSystemMetrics(SM_CYSCREEN);
centtop:=(smcy-fh) div 2;
end;
| Mivo.TV News |
| Mivo.TV News |

