简体   繁体   中英

shellexecute() function to open a link file is not working, don't know,why?

Code

int nRet = (int)ShellExecute( NULL, _T("open"), _T("C:\\Documents and Settings\\kse8.KSE\\Desktop\\lnk file\\1.lnk"),NULL, NULL, SW_SHOWNORMAL );

always getting

Error Code 2 in nRet

don't know why "1.lnk" file which is a shortcut of a pdf is not getting open ?

you can create these scenario simply by these steps 1)create a shortcut of a pdf file ie, (shift + f10) ,then "create shortcut" 2)rename it as 1.lnk both pdf file and shortcut are placed in the same folder of desktop. and then execute the command

int nRet = (int)ShellExecute( NULL, _T("open"), _T("C:\\Documents and Settings\\kse8.KSE\\Desktop\\lnk file\\1.lnk"),NULL, NULL, SW_SHOWNORMAL )

您的路径错误-'\\'是一个特殊字符,要获得准确的显示,应将其加倍- "C:\\\\Documents and Settings\\\\kse8.KSE\\\\Desktop\\\\lnk file\\\\1.lnk"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM