mirror of
https://github.com/moonlight-stream/Internet-Hosting-Tool.git
synced 2025-07-01 23:35:27 +00:00
Initialize COM before ShellExecute()
This commit is contained in:
parent
dad9b01a6f
commit
5d0b834efe
@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <shellapi.h>
|
||||
#include <objbase.h>
|
||||
|
||||
#pragma comment(lib, "miniupnpc.lib")
|
||||
#pragma comment(lib, "libnatpmp.lib")
|
||||
@ -96,7 +97,9 @@ void DisplayMessage(const char* message, bool error = true)
|
||||
"Moonlight Internet Streaming Tester", flags))
|
||||
{
|
||||
case IDYES:
|
||||
ShellExecuteA(nullptr, "open", logFilePath, nullptr, nullptr, SW_SHOW);
|
||||
// It's recommended to initialize COM before calling ShellExecute()
|
||||
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||
ShellExecuteA(nullptr, "open", logFilePath, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user