//代码如下:
HRESULT hr = CoInitialize(NULL);
if (SUCCEEDED(hr))
{
IShellLink *pisl;
hr = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pisl);
if (SUCCEEDED(hr))
{
IPersistFile* pIPF;
/
//这里是我们要创建快捷方式的原始文件地址
pisl->SetPath("c://windows//notepad.exe");
hr = pisl->QueryInterface(IID_IPersistFile, (void**)&pIPF);
if (SUCCEEDED(hr))
{
/
//这里是我们要创建快捷方式的目标地址
pIPF->Save(L"c:/记事本.lnk", FALSE);
pIPF->Release();
}
pisl->Release();
}
CoUninitialize();
}
That's all.