The find the folder containing the start menu, call SHGetSpecialFolderPath with the CSIDL_STARTMENU option. (In Win 7, this is usually c:\ProgramData\MicrosoftWindows\Start Menu, but might be different in other versions.)

The start menu items will be in .lnk files, which will have the path to the program. The format of a .lnk file is here: http://msdn.microsoft.com/en-us/library/dd871305.aspx.

Parsing a .lnk file by hand looks gnarly, here's an example of some code that should grab the path from the .lnk file, haven't tried it myself. http://delphi.about.com/od/windowsshellapi/l/aa072704a.htm

HTH

At 03:19 AM 9/6/2014, Irwin Scollar wrote:
More UAC complication:

I have written an application for 64 bit RadXE6 that has to spawn the Microsoft Image Compositing Editor (ICE) to stitch a large set of ortho-rectified images created by my program together with very high accuracy. By default the MSI installer puts ICE on a subdirectory of Program Files, and that can be found easily by using the %programfiles% environment variable plus the default ICE directory name.

However, the installer offers the user the option of changing the directory, partition or drive to put the executable and various other files like the DLL which actually does the stitching anywhere else. This is frequently chosen by users who either do not have permissions needed as granted by the UAC or those who prefer to put executables, data and the operating system on separate disks or separate partitions so that backups need not include the OS.

I therefore have to detect where ICE has been installed in order to spawn it from my executable. In the good old days, I used Turbo Power's Shell Shock to get a complete list of all programs accessible from the Start Menu with their installation directories. Unhappily, Shell Shock is not available in a 64 bit version.

As a "crutch", I wrote a small batch file which runs the WHERE command and which can search through all disks and partitions to find the ICE executable and write the information to a tiny file that is then read to get the required information. However, on a large workstation with many disks and partitions, this search takes a long time. It has to be repeated every time my program starts in case the user has installed an upgrade for ICE to a different drive, partition or directory. I also have to distinguish between 64 and 32 bit versions of ICE by looking at the size of the stitching DLL.

@echo off
rem done in chunks because of Item number limit in the for command
for %%a in (c d e f g h i j ) do if exist %%a:\ where /r %%a: ice.exe > found.txt for %%a in (k l m n o p q r) do if exist %%a:\ where /r %%a: ice.exe >> found.txt for %%a in (s t u v w x y z) do if exist %%a:\ where /r %%a: ice.exe >> found.txt

Is there a way to search through the full Start Menu like I used to do with Shell Shock to find a program and it's properties including the installation directory and drive name without using the elaborate technique employed by Shell Shock's Special Root method and which doesn't require scanning through all disks and partitions like I do with my batch file?

Irwin Scollar
_______________________________________________
Delphi mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to