转载:https://bbs.csdn.net/topics/34999
#include <iostream> #include <Shlobj.h> #include <atlstr.h> int main() { //CString strFilename("C:\Users\Administrator\Desktop\Lantern.lnk");//快捷方式 CString strFilename("C:\Users\Administrator\Desktop\test.txt");//具体文件 SHFILEINFO shFileInfo; SHGetFileInfo(strFilename,0,&shFileInfo,sizeof(SHFILEINFO), SHGFI_DISPLAYNAME|SHGFI_ICON|SHGFI_SMALLICON|SHGFI_TYPENAME|SHGFI_ATTRIBUTES); if(shFileInfo.dwAttributes&SFGAO_LINK) {//是快捷方式 MessageBox(NULL,L"是快捷方式",L"tip",MB_OK); } else { MessageBox(NULL,L"不是快捷方式",L"tip",MB_OK); } return 0; }