Question:
Sometimes, windows moves startmenu's directory while installed big program like DCS of Big Enterprises system. I wish to have application to get real directory of Start Menu's.
Answer:
With ActiveX, we can get real start menu's directory,
please try this code. I wish this answer your question.
uses
ShlObj, ActiveX;
procedure FreePidl(pidl: PItemIDList);
var
allocator: IMalloc;
begin
if Succeeded(SHGetMalloc(allocator)) then
begin
allocator.Free(pidl);
{$IFDEF VER100}
allocator.Release;
{$ENDIF}
end;
end;
function GetStartMenu: string;
var
pidl: PItemIDList;
buf: array[0..MAX_PATH] of Char;
begin
if Succeeded(SHGetSpecialFolderLocation(Form1.Handle, CSIDL_STARTMENU, pidl)) then
SHGetPathFromIDList(pidl, buf);
Result := StrPas(buf);
FreePIDL(pidl);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption := GetStartMenu;
end;
Subscribe to:
Post Comments (Atom)






0 Responses so far.
Post a Comment
Thank you for your comment.
Any request and idea are welcome.