本文整理汇总了C++中IShellLink::GetShowCmd方法的典型用法代码示例。如果您正苦于以下问题:C++ IShellLink::GetShowCmd方法的具体用法?C++ IShellLink::GetShowCmd怎么用?C++ IShellLink::GetShowCmd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IShellLink
的用法示例。
在下文中一共展示了IShellLink::GetShowCmd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: int
void Shortcut_Run(const char* szLink, const char* szWorkdir) {
wchar_t wszLink[MAX_PATH] = {};
::MultiByteToWideChar(CP_ACP, NULL, szLink, int(strlen(szLink)), wszLink, MAX_PATH);
IShellLink *pShellLink;
HRESULT hRes;
::CoInitialize(NULL);
hRes = CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(void **)&pShellLink);
if(SUCCEEDED(hRes)) {
IPersistFile *ppf;
hRes = pShellLink->QueryInterface(IID_IPersistFile,(void **)&ppf);
if(SUCCEEDED(hRes)) {
hRes = ppf->Load(wszLink, TRUE);
if(SUCCEEDED(hRes)) {
int show = SW_SHOW;
char path[MAX_PATH] = {};
char workdir[MAX_PATH] = {};
pShellLink->GetShowCmd(&show);
pShellLink->GetPath(path, MAX_PATH, NULL, 0);
pShellLink->GetWorkingDirectory(workdir, MAX_PATH);
if(path[0] != 0) {
ShellExecute(NULL, "open", path, NULL, workdir, show);
}
}
ppf->Release();
}
pShellLink->Release();
}
::CoUninitialize();
}
示例2: OleSetOleError
// @pymethod int|PyIShellLink|GetShowCmd|Retrieves the show (SW_) command for a shell link object.
PyObject *PyIShellLink::GetShowCmd(PyObject *self, PyObject *args)
{
IShellLink *pISL = GetI(self);
if ( pISL == NULL )
return NULL;
HRESULT hr;
int iShowCmd;
PY_INTERFACE_PRECALL;
hr = pISL->GetShowCmd( &iShowCmd );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return OleSetOleError(hr);
return PyInt_FromLong(iShowCmd);
}