1st of all the code as shown does not properly initialise info
.
To fix this change
SHELLEXECUTEINFO info;
to be
SHELLEXECUTEINFO info = {0};
2ndly use SEE_MASK_INVOKEIDLIST
for SHELLEXECUTEINFO
's member fMask
.
For your reference: https://msdn.microsoft.com/en-us/library/windows/desktop/bb759784%28v=vs.85%29.aspx
Please note that to see the properties window open, the invoking code must not end immediately. So add something like
Sleep(10000);
to the end of your test code as shown.
Full code that works for me:
#include <windows.h>
int main(void)
{
SHELLEXECUTEINFO info = {0};
info.cbSize = sizeof info;
info.lpFile = L"C:\tmp\tmp.txt";
info.nShow = SW_SHOW;
info.fMask = SEE_MASK_INVOKEIDLIST;
info.lpVerb = L"properties";
ShellExecuteEx(&info);
Sleep(10000);
}
Build options:
/ZI /nologo /W3 /WX- /Od /Oy- /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fp"DebugSOxyzConsoleEmpty.pch" /Fa"Debug" /Fo"Debug" /Fd"Debugvc100.pdb" /Gd /TC /analyze- /errorReport:queue
(Tested with VS2010, running Windows 7)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…