Delphi

Delphi

Delphi 快速选择文件夹路径

130 0

uses ShlObj;function FindFolder(Handle: THandle; Title: string = '请选择文件夹路径'): string;var lpItemID: PItemIDList; BrowseInfo: TBrowseInfo; DisplayName: array[0..MAX_PATH] of char; TempPath: array[0..MAX_PATH] of char;begin Result := ''

Delphi

Delphi 删除或清除TStringGrid中的行

53 0

type TStringGridRowDeletion = class helper for TStringGrid public procedure RemoveRows(RowIndex, RCount: Integer); procedure Clear; end;{ TStringGridRowDeletion } procedure TStringGridRowDeletion.Clear;var i: integer;begin for i := 0 to RowCou

Delphi

Delphi 显示Windows断开网络驱动器对话框

26 0

此代码显示如何显示Windows断开网络驱动器对话框。 如果用户单击“确定”,则所选的网络驱动器将断开连接并返回True。如果用户取消或出现错误,则返回False。 OwnerHandle是拥有对话框的窗口的句柄。function DisconnectNetworkDriveDialog(const OwnerHandle: THandle): Boolean;begin Result := WNetDisconnectDialog( OwnerHandle, RESOURCETYPE_DISK

Delphi

Delphi ShellExecute多种用法

125 0

Example 1Execute NotePad:ShellExecute( Application.Handle, 'open', 'c:\Windows\notepad.exe', nil, nil, SW_SHOWNORMAL);Example 2Open SomeText.txt in NotePad:ShellExecute( Application.Handle, 'open', 'c:\windows\notepad

Delphi

Delphi 检测应用程序是否已停止响应

45 0

procedure TForm2.Button1Click(Sender: TObject);var H : THandle; lngReturnValue : longint; DWResult : DWORD;begin H := FindWindow('Notepad', nil); if H > 0 then begin lngReturnValue := SendMessageTimeout( H, WM_NULL, 0, 0, SMTO_AB

Delphi

Delphi 删除文件函数支持撤销删除

45 0

uses ShellAPI;function DeleteFileWithUndo(sFileName: string): boolean;var fos: TSHFileOpStruct;begin FillChar(fos, SizeOf(fos), 0); with fos do begin//delphitop.com wFunc := FO_DELETE; pFrom := PChar( sFileName ); fFlags := FOF_ALLOWUNDO o

Delphi

Delphi 在TMemo中查找文本

45 0

procedure TForm1.Button3Click(Sender: TObject);var I, L: Integer;begin Memo1.WordWrap:= False; Memo1.Lines.LoadFromFile('Windows.pas'); I:= Pos('finalization', Memo1.Text); if I > 0 then begin L := SendMessage(Memo1.Handle, EM_

Delphi

Delphi TList性能注意事项

32 0

TList性能注意事项 本文虽然是用TList为例,但同样适用于Tstringlist,Tobjectlist等列表类。1)提取/删除列表中的元素例如,在包含65536个元素的列表中:while list.Count > 0 do List.Delete(0) //完成需要2分钟for I := List.Count-1 downto 0 do List.Delete(I) //完成时间少于1秒同样是删除65536个元素,为什么2种方法所需时间相差如此之大?因为删除项目[0]比删除项目[计数-1]