2000 C:\Documents and Settings\Administrator\「开始」菜单\程序
用ShellTreeView组件和ShellListView组件(都是delphi7自带的) ShellListView组件的root值设为 C:\Documents and Settings\用户名\「开始」菜单\程序 就可以了
C:\Documents and Settings\用户名\「开始」菜单\程序 这里是win2k的 win98等,自己搞定吧,
uses shlobj... function GetPROGRAMSFolder:string; var pidl:pItemIDList; buffer:array[0..255] of char; begin SHGetSpecialFolderLocation(application.Handle,CSIDL_PROGRAMS,pidl); SHGetPathFromIDList(pidl,buffer); result:=strpas(buffer); end;这样就得到了程序的文件夹,再用 procedure TForm.program; var f:tsearchrec; winDir: array [0..255] of char; s:string; begin GetWindowsDirectory(winDir,255); if findfirst(GetPROGRAMSFolder+'\*.*',$37,f)=0 then begin while findnext(f)=0 do begin if (f.Attr shr 4)=1 then begin if f.Name[1]<>'.' then s:=s+'程序组-- '+f.Name+#10; end else s:=s+copy(f.Name,1,length(f.Name)-4)+#10; end; findclose(f); showmessage(s); end; end;
C:\Documents and Settings\Administrator\「开始」菜单\程序
ShellListView组件的root值设为
C:\Documents and Settings\用户名\「开始」菜单\程序
就可以了
这里是win2k的
win98等,自己搞定吧,
function GetPROGRAMSFolder:string;
var
pidl:pItemIDList;
buffer:array[0..255] of char;
begin
SHGetSpecialFolderLocation(application.Handle,CSIDL_PROGRAMS,pidl);
SHGetPathFromIDList(pidl,buffer);
result:=strpas(buffer);
end;这样就得到了程序的文件夹,再用
procedure TForm.program;
var
f:tsearchrec;
winDir: array [0..255] of char;
s:string;
begin
GetWindowsDirectory(winDir,255);
if findfirst(GetPROGRAMSFolder+'\*.*',$37,f)=0 then begin
while findnext(f)=0 do begin
if (f.Attr shr 4)=1 then begin
if f.Name[1]<>'.' then s:=s+'程序组-- '+f.Name+#10;
end
else
s:=s+copy(f.Name,1,length(f.Name)-4)+#10;
end;
findclose(f);
showmessage(s);
end;
end;