دو ال و أكواد متفرقة
#2
في البداية السلام عليكم


Total Physical Memory

كود :
function TotalPhysicalMemory: Int64; var MemStat: TMemoryStatus; begin MemStat.dwLength := SizeOf(MemStat); GlobalMemoryStatus(MemStat); result := MemStat.dwTotalPhys; end;

Total Page Memory

كود :
function TotalPageMemory: Int64; var MemStat: TMemoryStatus; begin MemStat.dwLength := SizeOf(MemStat); GlobalMemoryStatus(MemStat); result := MemStat.dwTotalPageFile; end;

Available Page Memory

كود :
function AvailablePageMemory: Int64; var MemStat: TMemoryStatus; begin MemStat.dwLength := SizeOf(MemStat); GlobalMemoryStatus(MemStat); result := MemStat.dwAvailPageFile; end;

Available Physical Memory

كود :
function AvailablePhysicalMemory: Int64; var MemStat: TMemoryStatus; begin MemStat.dwLength := SizeOf(MemStat); GlobalMemoryStatus(MemStat); result := MemStat.dwAvailPhys; end;

Available Virtual Memory

كود :
function AvailableVirtualMemory: Int64; var MemStat: TMemoryStatus; begin MemStat.dwLength := SizeOf(MemStat); GlobalMemoryStatus(MemStat); result := MemStat.dwAvailVirtual; end;

Memory Used Percentage

كود :
function MemoryUsedPercentage: Integer; var MemStat: TMemoryStatus; begin MemStat.dwLength := SizeOf(MemStat); GlobalMemoryStatus(MemStat); result := MemStat.dwMemoryLoad; end;

Application Is Responding

كود :
function AppIsResponding(const ClassName: string; const TimeOut: Cardinal): Boolean; var Res: DWORD; h: HWND; bClassFound, bSendMessage: Boolean; begin bSendMessage := FALSE; h := FindWindow(PChar(ClassName), nil); bClassFound := (h <> 0); if bClassFound then bSendMessage := (SendMessageTimeout(H, WM_NULL, 0, 0, SMTO_NORMAL or SMTO_ABORTIFHUNG, TIMEOUT, Res) <> 0); result := (bClassFound and bSendMessage); end

App Exec

كود :
function AppExec(const CmdLine, CmdParams: string; const CmdShow: Integer): Boolean; begin result := (ShellExecute(GetCurrentProcess, 'open', PChar(CmdLine), PChar(CmdParams), '', CmdShow) > 32); end;

App Restart

كود :
procedure AppRestart; begin AppExec(ParamStr(0), '', SW_SHOW); // <<-- Function AppExec is here TerminateProcess(GetCurrentProcess, 0); end;

Exec And Wait

كود :
uses ShellAPI; procedure ExecAndWait(const FileName, Params: string; const CmdShow: Integer); var exInfo: TShellExecuteInfo; Ph: DWORD; begin FillChar(exInfo, SizeOf(exInfo), 0); with exInfo do begin cbSize := SizeOf(exInfo); fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT; Wnd := GetActiveWindow(); ExInfo.lpVerb := 'open'; ExInfo.lpParameters := PChar(Params); lpFile := PChar(FileName); nShow := CmdShow; end; if ShellExecuteEx(@exInfo) then Ph := exInfo.HProcess else begin ShowMessage(SysErrorMessage(GetLastError)); Exit; end; while WaitForSingleObject(ExInfo.hProcess, 50) <> WAIT_OBJECT_0 do ProcessMessages; CloseHandle(Ph); end;

App Maximize

كود :
procedure AppMaximize(hWin: HWND); begin SendMessage(hWin, WM_SYSCOMMAND, SC_MAXIMIZE, 0); end;

App Minimize

كود :
procedure AppMinimize(hWin: HWND); begin SendMessage(hWin, WM_SYSCOMMAND, SC_MINIMIZE, 0); end;

Caps Lock State

كود :
function CapsLockState: Bool; var KS: TKeyboardState; begin GetKeyboardState(KS); if bool(ks[020]) then Result := True else Result := False; end;

Shift State

كود :
function ShiftState: BOOL; var KS: TKeyboardState; begin GetKeyboardState(KS); if bool(ks[016]) then Result := True else Result := False; end;

Insert State

كود :
function InsertState: BOOL; var KS: TKeyboardState; begin GetKeyboardState(KS); if bool(ks[045]) then Result := True else Result := False; end

Num Lock State

كود :
function NumLockState: BOOL; var KS: TKeyboardState; begin GetKeyboardState(KS); if bool(ks[144]) then Result := True else Result := False; end;

Contrl State

كود :
function ContrlState: BOOL; var KS: TKeyboardState; begin GetKeyboardState(KS); if bool(ks[017]) then Result := True else Result := False; end;

Delete State

كود :
function DeleteState: BOOL; var KS: TKeyboardState; begin GetKeyboardState(KS); if bool(ks[046]) then Result := True else Result := False; end;

و السلام.
الرد


الردود في هذا الموضوع
دو ال و أكواد متفرقة - بواسطة MjIrIm - 02-09-2009, 05:08 PM
دو ال و أكواد متفرقة - بواسطة MjIrIm - 02-09-2009, 05:22 PM
دو ال و أكواد متفرقة - بواسطة AL-MOB4RM3G - 03-09-2009, 06:00 AM
دو ال و أكواد متفرقة - بواسطة kachwahed - 03-09-2009, 12:17 PM
دو ال و أكواد متفرقة - بواسطة musvc - 03-09-2009, 08:07 PM
دو ال و أكواد متفرقة - بواسطة me_delphi - 03-09-2009, 11:28 PM
دو ال و أكواد متفرقة - بواسطة MjIrIm - 22-09-2009, 09:38 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم