I revised a example to get the full path use the application name.
AssocQueryString(ASSOCF_IGNOREUNKNOWN|ASSOCF_NOTRUNCATE|ASSOCF_OPEN_BYEXENAME,
ASSOCSTR_EXECUTABLE,
lpszExt,
NULL,
lpszApplication,
nSize);
This function works correctly to get the full path of "EXCEL.EXE" on winXP and Vista(windows7). It can get the full path as following (winword.exe,notepad.exe,Acrobat.exe,etc)
But it can't get the "WinRAR.exe" on vista or windows7.It also fails to get full path of other software (cuteftppro.exe,QQ.exe,egui.exe).
I want to know how to resolve this problem.
Thank you very much!
这个是我在codeproject上看到的一个有意思的帖子,我修改过作者的源码后,发现代码在vista上有时不能正常的得到结果,所以发帖。希望探究这个API函数的使用。
原帖的地址是:
http://www.codeproject.com/KB/shell/ExecApp.aspx