我使用MS COM C ++中的接口IFileSaveDialog。我使用了example,但做了些微改动:
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED |
COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
IFileOpenDialog* pFileOpen;
hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_ALL,
IID_IFileOpenDialog, reinterpret_cast<void**>(&pFileOpen));
if (SUCCEEDED(hr))
{
hr = pFileOpen->Show(NULL);
pFileOpen->Release();
}
CoUninitialize();
}
return 0;
}
这是可行的,但是调试器Visual Studio写入了列表错误:
Exception thrown at 0x00007FFBF6D29129 (KernelBase.dll) in test_filesavedialog.exe: 0x000006BA: The RPC server is unavailable.
shell\osshell\lmui\ntshrui\dll\shrengine.cpp(1487)\ntshrui.dll!00007FFBD8E394D0: (caller: 00007FFBD8E34ED1) ReturnHr(1) tid(13c0) 80004005 Unknown error
shell\osshell\lmui\ntshrui\dll\shrengine.cpp(1487)\ntshrui.dll!00007FFBD8E394D0: (caller: 00007FFBD8E34ED1) ReturnHr(2) tid(3f94) 80004005 Unknown error
onecoreuap\shell\ext\thumbnailcache\lib\thumbcacheobj.cpp(2076)\thumbcache.dll!00007FFBD7D631A6: (caller: 00007FFBD7D51E95) ReturnHr(1) tid(2920) 80070057 Parameter is incorrect.
onecoreuap\shell\ext\thumbnailcache\lib\thumbcacheobj.cpp(2076)\thumbcache.dll!00007FFBD7D631A6: (caller: 00007FFBD7D51E95) ReturnHr(2) tid(2920) 80070057 Parameter is incorrect.
onecoreuap\shell\ext\thumbnailcache\lib\thumbcacheobj.cpp(2076)\thumbcache.dll!00007FFBD7D631A6: (caller: 00007FFBD7D51E95) ReturnHr(3) tid(2920) 80070057 Parameter is incorrect.
如何解决此问题以及为什么会出现此问题?谢谢。