procedure TForm1.Button۱Click(Sender: TObject);
var
s:string;
sos:tlocateoptions;
begin
s:=inputbox(' Please Enter Product Name ' , 'Product Name','');
if s='' then exit;
if table1.IsEmpty then
begin
Messagebox (0,pchar (' Database is Empty '),'Error',0);
exit;
end;
sos:=[lopartialkey]+[loCaseInsensitive];
if not table1.Locate ('Product Name' , s ,sos )
then showmessage (' Nothing ')
end;
ReStart Windows:
function DoExitWindows(RebootParam: Longword): boolean;
var
TTokenHd: THandle;
TTokenPvg: TTokenPrivileges;
cbtpPrevious: DWORD;
rTTokenPvg: TTokenPrivileges;
pcbtpPreviousRequired: DWORD;
tpResult: boolean;
const
cSE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
begin
if (Win32Platform = VER_PLATFORM_WIN32_NT) then
begin
tpResult := OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES
or TOKEN_QUERY, TTokenHd);
if tpResult then
begin
tpResult := LookupPrivilegeValue(nil, cSE_SHUTDOWN_NAME,
TTokenPvg.Privileges[0].Luid);
TTokenPvg.PrivilegeCount := 1;
TTokenPvg.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
cbtpPrevious := SizeOf(rTTokenPvg);
pcbtpPreviousRequired := 0;
if tpResult then
Windows.AdjustTokenPrivileges(TTokenHd, false, TTokenPvg, cbtpPrevious,
rTTokenPvg, pcbtpPreviousRequired);
end;
end;
Result := ExitWindowsEx(RebootParam, 0);
end;
