mkdir repo
cd repo
git init
mkdir temp
touch temp/in.tmp
touch out.tmp
echo '*tmp' > .gitignore
Run Code Online (Sandbox Code Playgroud)
使用git clean -Xn时显示Would remove out.tmp
但我想删除temp/in.tmp在一起
git clean -Xdn不起作用,但cd对temp目录和运行git clean -Xn它显示Would remove in.tmp
所以我想知道是否有一个命令删除.gitignoreinclude子目录中的所有文件列表,在这种情况下如何使用git cleanremove temp/in.tmp和out.tmp
$ git --version
git version 1.9.5.msysgit.1
Run Code Online (Sandbox Code Playgroud)
我发现了一些奇怪的东西
在temp目录中添加一个文件并暂存它,git clean -Xn似乎工作
touch temp/a.txt
git add temp/a.txt
git clean -Xn
Run Code Online (Sandbox Code Playgroud)
它表明
Would remove out.tmp
Would remove temp/in.tmp …Run Code Online (Sandbox Code Playgroud) 我ShellExecute用来做某事,第一个参数是HWND ,MSDN上的文档说:
父窗口的句柄,用于显示UI或错误消息.如果操作未与窗口关联,则此值可以为NULL.
但我发现无论哪个HWND值得到相同的结果.
例如 :
ShellExecute(0, 'open', 'c:\', nil, nil, SW_SHOWNORMAL);
ShellExecute(Self.Handle, 'open', 'c:\', nil, nil, SW_SHOWNORMAL);
ShellExecute(123456, 'open', 'c:\', nil, nil, SW_SHOWNORMAL);
只是得到相同的东西(打开磁盘C),所以我想知道使用不同的用途是什么HWND?
顺便说一下,当'HWND = 0'使用DeskTop的Handle时?
第一个程序:
procedure TestOne(List : TStringList);
var
TempList : TStringList;
begin
TempList := TStringList.Create;
TempList.Add('Test');
List := TempList;
TempList.Free;
end;
procedure TForm1.Button1Click(Sender : TObject);
var
aList : TStringList;
begin
aList := TStringList.Create;
TestOne(aList);
Memo1.Lines := aList;
end;
Run Code Online (Sandbox Code Playgroud)
当我单击按钮时,备忘录不显示任何内容,并且断点显示该过程不执行此行:
List := TempList;
Run Code Online (Sandbox Code Playgroud)

我修改了程序:
procedure TestTwo(List : TStringList);
var
TempList : TStringList;
begin
TempList := TStringList.Create;
TempList.Add('Test');
List.Text := TempList.Text;
//or
List.Assign(TempList);
//List := TempList;
TempList.Free;
end;
Run Code Online (Sandbox Code Playgroud)
这次它有效.
那么为什么它不能使用List := TempList;?
我使用 FilePathDialog.SelectedPath 获取文件夹的路径我也知道图标的路径,但我不知道如何设置该文件夹的图标
我使用此代码来获取系统时间:
procedure GetSystemUpTime(var Hour, Minute : integer);
function GetSysTime : dword;
asm
int $2a
end;
begin
Hour := GetSysTime() div 3600000;
Minute := GetSysTime() mod 3600000 div 60000;
end;
procedure TForm1.Button1Click(Sender : TObject);
var
H, M : integer;
begin
GetSystemUpTime(H, M);
Label1.Caption := IntToStr(H) + ':' + IntToStr(M);
end;
Run Code Online (Sandbox Code Playgroud)
我测试它win8 x86并且XP x86它可以工作,但是win7 x64 错误地输入了:

我想知道如何在x64中获得系统中断,任何人都可以修复它吗?
这是我的示例代码:
type
PData = ^TData;
TData = record
str : string;
strlist : TStringList;
end;
var
P1 : PData;
P2 : PData;
P3 : PData;
P4 : PData;
begin
New(P1);
New(P2);
P1.str := 'string';
// copy
P2^ := P1^;
P2.str := P2.str + '_copy';
Memo1.Lines.Add('This is P1:' + P1.str); //This is P1:string
Memo1.Lines.Add('This is P2:' + P2.str); //This is P2:string_copy
// so change P2'Data didn't change P1's Data
// but this :
New(P3);
New(P4);
P3.str := 'string';
P3.strlist := TStringList.Create; …Run Code Online (Sandbox Code Playgroud) 我曾经TiniFile读过一个inf文件.但在某些部分,身份是相同的, TiniFile无法读取它.
例如 :
这个部分 :
[AMD.Mfg]
%AMD.DeviceDesc0% = AMDSMBus, PCI\VEN_1002&DEV_4353
%AMD.DeviceDesc0% = AMDSMBus, PCI\VEN_1002&DEV_4363
%AMD.DeviceDesc0% = AMDSMBus, PCI\VEN_1002&DEV_4372
%AMD.DeviceDesc0% = AMDSMBus, PCI\VEN_1002&DEV_4385
%AMD.DeviceDesc0% = AMDSMBus, PCI\VEN_1022&DEV_780B
Run Code Online (Sandbox Code Playgroud)
我的代码:
var
inf : TiniFile;
list : TStringList;
begin
//Create
inf := TIniFile.Create(infPath);
list := TStringList.Create;
inf.ReadSectionValues('AMD.Mfg', list);
Memo1.Lines.AddStrings(list2);
end;
Run Code Online (Sandbox Code Playgroud)
它显示这个:
%AMD.DeviceDesc0%=AMDSMBus, PCI\VEN_1002&DEV_4353
%AMD.DeviceDesc0%=AMDSMBus, PCI\VEN_1002&DEV_4353
%AMD.DeviceDesc0%=AMDSMBus, PCI\VEN_1002&DEV_4353
%AMD.DeviceDesc0%=AMDSMBus, PCI\VEN_1002&DEV_4353
%AMD.DeviceDesc0%=AMDSMBus, PCI\VEN_1002&DEV_4353
Run Code Online (Sandbox Code Playgroud)
我猜相同的身份导致了这一点,所以我的问题是当身份相同时如何阅读它?
我想枚举中的所有文件 C:\Windows\Fonts\
首先我FindFirst&FindNext用来获取所有文件
码:
Path := 'C:\Windows\Fonts';
if FindFirst(Path + '\*', faNormal, FileRec) = 0 then
repeat
Memo1.Lines.Add(FileRec.Name);
until FindNext(FileRec) <> 0;
FindClose(FileRec);
Run Code Online (Sandbox Code Playgroud)
它得到一些像在Windows字体文件夹中tahoma.ttf显示的 名称Tahoma regular.
但是我怎么能这样呢?
第二我为什么不能通过C:\Windows\Fonts\shell 枚举文件
代码:
var
psfDeskTop : IShellFolder;
psfFont : IShellFolder;
pidFont : PITEMIDLIST;
pidChild : PITEMIDLIST;
pidAbsolute : PItemIdList;
FileInfo : SHFILEINFOW;
pEnumList : IEnumIDList;
celtFetched : ULONG;
begin
OleCheck(SHGetDesktopFolder(psfDeskTop));
//Font folder path
OleCheck(SHGetSpecialFolderLocation(0, CSIDL_FONTS, pidFont));
OleCheck(psfDeskTop.BindToObject(pidFont, nil, IID_IShellFolder, psfFont));
OleCheck(psfFont.EnumObjects(0, SHCONTF_NONFOLDERS or SHCONTF_INCLUDEHIDDEN
or …Run Code Online (Sandbox Code Playgroud) 我想从Windows库获取文件夹路径(例如:Libraries \ Documents)。我发现它需要使用IShellLibrary接口,但在ShlObj(Delphi 2009 x64 win7)中找不到声明。我想知道如何将此接口导入我的代码?

我得到一个字体文件的绝对PIDL命名 FontPIDL
我用这段代码打开它:var ShExeInfo:SHELLEXECUTEINFO;
begin
ZeroMemory(@ShExeInfo, SizeOf(ShExeInfo));
ShExeInfo.cbSize := SizeOf(ShExeInfo);
ShExeInfo.lpVerb := 'Open';
ShExeInfo.lpIDList := FontPIDL;
ShExeInfo.nShow := SW_SHOWNORMAL;
ShExeInfo.fMask := SEE_MASK_IDLIST;
end;
Run Code Online (Sandbox Code Playgroud)
得到一个错误: The parameter is incorrect
我想知道如何解决它?是我想念的一些参数?
更新:
我如何得到字体文件绝对PIDL:
var
psfDeskTop : IShellFolder;
psfFont : IShellFolder;
pEnumList : IEnumIdList;
pidFont : PItemIdList;
pidChild : PItemIdList;
pidAbFont : PItemIdList;
FontPath : array[0..MAX_PATH - 1] of Char;
pchEaten, dwAttributes, ItemsFetched : ULONG;
begin
FillChar(FontPath, sizeof(FontPath), #0);
SHGetSpecialFolderPath(0, FontPath, CSIDL_FONTS, False);
SHGetDesktopFolder(psfDeskTop);
psfDeskTop.ParseDisplayName(0, nil, FontPath, pchEaten, pidFont,
dwAttributes);
psfDeskTop.BindToObject(pidFont, nil, IID_IShellFolder, …Run Code Online (Sandbox Code Playgroud)