We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c11377a commit 923f0dfCopy full SHA for 923f0df
MyExeServerCpp/Main.cpp
@@ -29,12 +29,18 @@ MyserverModule _AtlModule;
29
30
31
// EXE Entry Point
32
-int wmain(int /*argc*/, wchar_t* /*argv*/[]) {
+int wmain(int argc, wchar_t* /*argv*/[]) {
33
// initialize COM early for programmatic COM security
34
_AtlModule.InitializeCom();
35
HRESULT hr = _AtlModule.InitializeSecurity();
36
if (FAILED(hr))
37
abort();
38
39
+ if (argc == 1) {
40
+ // process started without arguments
41
+ // add an artificial reference to make the server outlive COM clients
42
+ CoAddRefServerProcess();
43
+ }
44
+
45
return _AtlModule.WinMain(SW_SHOWDEFAULT);
46
}
0 commit comments