Delphi

Delphi

Delphi 获取闪盘列表

30 0

function GetFlashDisks: TStrings;var buf: array[0..MAX_PATH - 1] of Char; M_Result: Integer; i: Integer; tmpStr: string;begin Result := TStringList.Create; M_Result := GetLogicalDriveStrings(MAX_PATH, buf); for i := 0 to (M_Result div 4) do begin

Delphi

Delphi 根据磁盘盘符获取简单的硬盘编号

44 0

function GetHDCode(Drv: string): string;var VolumeSerialNumber: DWORD; MaximumComponentLength: DWORD; FileSystemFlags: DWORD;begin if Drv[Length(Drv)] = ':' then Drv := Drv + '\'; GetVolumeInformation(Pchar(Drv), nil, 0, @VolumeSe

Delphi

Delphi 验证GUID的函数

43 0

uses System.Win.ComObj,ActiveX;function CheckComObj(progID: string): Boolean;var myGuid: TGUID;begin Result := False; try OleCheck(CLSIDFromProgID(Pchar(progID), myGuid)); if IsEqualGUID(myGuid, GUID_NULL) = False then Result := True; exce

Delphi

Delphi 快速读取写入注册表参数值的函数

71 0

uses Registry;function ReadRegisry(RegKey: string; Default: string; MyRootKey: Hkey; MyOpenKey: string): string;var Registry: TRegistry; s: string;begin Registry := TRegistry.Create; try begin Registry.RootKey := MyRootKey; // HKEY_CURRENT_US

Delphi

Delphi 指定在IE浏览器或IE内核打开链接

50 0

uses System.Win.ComObj;procedure OpenInIE(url: string);var IE: OleVariant;begin // IE := CoInternetExplorer.Create; // IE.Visible := True; // IE.Navigate2(url); IE := CreateOleObject('InternetExplorer.Application'); IE.visible := True; IE.

Delphi 合并字符串的函数
Delphi

Delphi 合并字符串的函数

83 0

function Join(mylist: TStrings; seperatorStr: string): string;var i: Integer;begin Result := string.Empty; for i := 0 to mylist.Count - 1 do begin Result := Result + mylist[i]; if i < mylist.Count - 1 then Result := Result + ' '

Delphi

Delphi截取字符串 防止中文截断

29 0

function GetText(strtxt:string;iLen:integer):string;begin//先判断要截取的字符串最后一个字节的类型//如果为汉字的第一个字节则减(加)一位if ByteType(strtxt,iLen) = mbLeadByte then iLen := iLen - 1;result := copy(strtxt,1,iLen) + ’...‘;end;