IShellLink * pShellLink ;
hres = ::CoCreateInstance( CLSID_ShellLink, NULL,CLSCTX_INPROC_SERVER, IID_IShellLink,(void **)&pShellLink);
if( SUCCEEDED( hres))
{
pShellLink -> SetPath(csExePath);
if(PathFileExists(csIconPath))
pShellLink -> SetIconLocation(csIconPath, 0);
pShellLink -> SetHotkey( MAKEWORD( 'R', HOTKEYF_SHIFT | HOTKEYF_CONTROL));
CString csWorkingDir;
csWorkingDir = csExePath.Left(2);
csWorkingDir.Append(FILE_SEPARATOR);
TRACE_CS(csWorkingDir);
pShellLink -> SetWorkingDirectory(csWorkingDir);
IPersistFile *pPersistFile;
hres = pShellLink -> QueryInterface( IID_IPersistFile, (void **)&pPersistFile) ;
if( SUCCEEDED(hres))
{
hres = pPersistFile -> Save(csLinkPath, TRUE);
pPersistFile -> Release();
}
pShellLink -> Release();
}
::CoUninitialize();
}
}
CString csInstallPath;
csInstallPath = g_InstallInfo.chInstallPath;
CString csEXEFilePath;
csEXEFilePath = csInstallPath;
csEXEFilePath.Append(FILE_SEPARATOR);
csEXEFilePath.Append(FILE_APP_NAME);
CString csUnExeFilePath;
csUnExeFilePath = csInstallPath;
csUnExeFilePath.Append(FILE_SEPARATOR);
csUnExeFilePath.Append(FILE_UNINSTALL_NAME);
CString csLinkFileName = csStartupFolder;
csLinkFileName.Append(FILE_SEPARATOR);
csLinkFileName.Append(LINK_NAME);
csLinkFileName.Append(LINK_EXT);
CString csUnlinkFileName = csStartupFolder;
csUnlinkFileName.Append(FILE_SEPARATOR);
csUnlinkFileName.Append(LINK_UNINSTALL_NAME);
csUnlinkFileName.Append(LINK_EXT);
//get icon path
CString csExeIconPath;
csExeIcOnPath= csInstallPath;
csExeIconPath.Append(FILE_SEPARATOR);
csExeIconPath.Append(ICON_APP_EXE_NAME);
CString csUnExeIconPath;
csUnExeIcOnPath= csInstallPath;
csUnExeIconPath.Append(FILE_SEPARATOR);
csUnExeIconPath.Append(ICON_UNINSTALL_EXE_NAME);
TRACE_CS(csLinkFileName);
TRACE_CS(csEXEFilePath);
TRACE_CS(csExeIconPath);
TRACE_CS(csUnlinkFileName);
TRACE_CS(csUnExeFilePath);
TRACE_CS(csUnExeIconPath);
CreateShortCut(csLinkFileName, csEXEFilePath, csExeIconPath);
CreateShortCut(csUnlinkFileName, csUnExeFilePath, csUnExeIconPath);
}