WinAPI: GetSystemInfo – 擷取系統資訊

//聲明:GetSystemInfo( var lpSystemInfo: TSystemInfo {});//TSystemInfo 是 _SYSTEM_INFO 結構的重定義:_SYSTEM_INFO = record case Integer of 0: ( dwOemId: DWORD); {返回電腦標識符, 已廢棄} 1: ( wProcessorArchitecture: Word; {處理器的體繫結構}

檔案管理類函數(1)

//判斷檔案是否存在 FileExistsvar f: string;begin f := 'c:\temp\test.txt'; if not FileExists(f) then begin //如果檔案不存在 end;end;//判斷檔案夾是否存在 DirectoryExistsvar dir: string;begin dir := 'c:\temp'; if not DirectoryExists(dir) then begin //如果檔案夾不存在

WinAPI: GetKeyboardType – 擷取鍵盤的類型資訊

//聲明:GetKeyboardType( nTypeFlag: Integer {0:鍵盤類型; 1:鍵盤子類型; 2:功能鍵數量}): Integer;//舉例:procedure TForm1.FormCreate(Sender: TObject);var i: Integer; List: TStringList;begin List := TStringList.Create; List.Add('IBM PC/XT or compatible (83-key)

WinAPI: GetDiskFreeSpace – 擷取磁碟組織與容量資訊

//聲明:GetDiskFreeSpace( lpRootPathName: PChar; {磁碟根路徑} var lpSectorsPerCluster: DWORD; {一個簇內的扇區數} var lpBytesPerSector: DWORD; {一個扇區內的位元組數} var lpNumberOfFreeClusters: DWORD; {剩餘簇數} var lpTotalNumberOfClusters: DWORD {總簇數}):

WinAPI: GetDiskFreeSpaceEx – 擷取磁碟容量資訊

//聲明:GetDiskFreeSpaceEx( lpDirectoryName: PChar; {磁碟根路徑} var lpFreeBytesAvailableToCaller: TLargeInteger; {可用空間} var lpTotalNumberOfBytes: TLargeInteger; {總空間} TotalFree: PLargeInteger

WinAPI: GetVolumeInformation – 讀取檔案系統資訊

//聲明:GetVolumeInformation( lpRootPathName: PChar; {磁碟機代碼字串} lpVolumeNameBuffer: PChar; {磁碟機卷標名稱} nVolumeNameSize: DWORD; {磁碟機卷標名稱長度} lpVolumeSerialNumber: PDWORD; {磁碟機卷標序號} var

WinAPI: GetLogicalDrives – 判斷系統中存在的邏輯磁碟機

//聲明:GetLogicalDrives: DWORD; {無參數}//傳回值:傳回值的二進位右邊第一位為 1 表示磁碟機 A: 存在;傳回值的二進位右邊第二位為 1 表示磁碟機 B: 存在...以次類推.//舉例:procedure TForm1.FormCreate(Sender: TObject);var Drives: DWord; i: Integer;begin Drives := GetLogicalDrives; Memo1.Clear; for i := 0 to

WinAPI: SetPixel 和 SetPixelV – 設定裝置環境中指定位置的顏色

//聲明:SetPixel( DC: HDC; {裝置環境控制代碼} X, Y: Integer; {座標} Color: COLORREF {顏色值}): COLORREF; {返回顏色值}SetPixelV( DC: HDC; {裝置環境控制代碼} X, Y: Integer; {座標} Color: COLORREF {顏色值}): BOOL;{SetPixel 與 SetPixelV 功能一致, 但傳回值不一樣; 書上說

WinAPI: GetLogicalDriveStrings – 擷取系統中存在的邏輯磁碟機字串

//聲明:GetLogicalDriveStrings( nBufferLength: DWORD; {緩衝區大小} lpBuffer: PAnsiChar {緩衝區}): DWORD;//緩衝區的結果是這樣儲存的: 譬如 A 磁碟機會表示為 A:\ 後面隔一個Null 字元, 依次向後;//所以每個磁碟機會佔 4 位元組.//舉例:procedure TForm1.FormCreate(Sender: TObject);var PStr: PChar; DriveArr:

WinAPI: DrawFrameControl – 繪製控制項

//聲明:DrawFrameControl( DC: HDC; {裝置環境控制代碼} const Rect: TRect; {矩形} uType, uState: UINT {控制項類型與控制項狀態}): BOOL;//控制項類型 uType 參數可選值:DFC_CAPTION = 1; {標題按鈕}DFC_MENU = 2; {菜單}DFC_SCROLL = 3; {捲軸按鈕}DFC_BUTTON = 4;

WinAPI: SetWindowPos – 改變視窗的位置與狀態

//聲明:SetWindowPos( hWnd: HWND; {視窗控制代碼} hWndInsertAfter: HWND; {視窗的 Z 順序} X, Y: Integer; {位置} cx, cy: Integer; {大小} uFlags: UINT {選項}): BOOL;//hWndInsertAfter 參數可選值:HWND_TOP = 0; {在前面}HWND_BOTTOM

WinAPI: CreateDirectory – 建立檔案夾

//聲明:CreateDirectory( lpPathName: PChar; {目錄名} lpSecurityAttributes: PSecurityAttributes {TSecurityAttributes 結構的指標}): BOOL;//TSecurityAttributes 是 _SECURITY_ATTRIBUTES 結構的重定義_SECURITY_ATTRIBUTES = record nLength: DWORD;

Application.ProcessMessages

//如果有這樣一個迴圈, 是非常可怕的; 因為它完不了, 你得等著.procedure TForm1.Button1Click(Sender: TObject);var i: Integer;begin for i := 0 to MaxInt do begin Text := IntToStr(i); end;end;//即使這樣也無濟於事, 因為在迴圈期間你執行不了 Button2Clickvar b: Boolean;procedure

WinAPI: CreateDirectoryEx – 根據模版建立檔案夾

//聲明:CreateDirectoryEx ( lpTemplateDirectory: PChar; {模版目錄名} lpPathName: PChar; {新目錄名} lpSecurityAttributes: PSecurityAttributes {TSecurityAttributes 結構的指標}): BOOL;//TSecurityAttributes 是 _SECURITY_ATTRIBUTES

一種擷取不帶正負號的整數最大值的方法:

//一種擷取不帶正負號的整數最大值的方法:procedure TForm1.Button1Click(Sender: TObject);var {Delphi 標準的不帶正負號的整數類型只有三種} num_Byte : Byte; num_Word : Word; num_Cardinal : Cardinal; {Windows API 中相應的類型就太多了, 下面是隨便找了幾種} api_UCHAR : UCHAR; {Byte}

WinAPI: GetLocalTime、SetLocalTime、SetSystemTime – 擷取與設定系統時間

//聲明GetLocalTime( var lpSystemTime: TSystemTime {TSystemTime 結構}); {無傳回值}//設定本地時間SetLocalTime( const lpSystemTime: TSystemTime {TSystemTime 結構}): BOOL;//SetSystemTime 設定的是格林尼治時間SetSystemTime( const lpSystemTime:

WinAPI: GetFocus – 擷取當前擁有焦點的視窗的控制代碼

//聲明:GetFocus: HWND; {無參數; 返回當前擁有焦點視窗的控制代碼}//舉例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo;

WinAPI: GetSystemPowerStatus – 擷取系統電源狀態的資訊

//聲明GetSystemPowerStatus( var lpSystemPowerStatus: TSystemPowerStatus {TSystemPowerStatus 結構}): BOOL;//TSystemPowerStatus 是 _SYSTEM_POWER_STATUS 結構的重定義:_SYSTEM_POWER_STATUS = packed record ACLineStatus : Byte; {0:電源斷電; 1:電源正常; 255:電源狀態未知}

WinAPI: LoadCursor – 從資源中載入游標

//聲明:LoadCursor( hInstance: HINST; {EXE 或 DLL 的控制代碼, 0 表示載入系統資源} lpCursorName: PChar {資源標識符}): HCURSOR; {返回游標控制代碼}這裡有樣本//調用系統游標的例子:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

WinAPI: LoadIcon – 從資源中載入表徵圖

//聲明:LoadIcon( hInstance: HINST; {EXE 或 DLL 的控制代碼, 0 表示載入系統資源} lpIconName: PChar {資源標識符}): HICON; {返回表徵圖控制代碼}這裡有樣本//調用系統表徵圖的例子:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,

總頁數: 61357 1 .... 4793 4794 4795 4796 4797 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.