Skip to content

Commit 0156612

Browse files
author
Colin Robertson
authored
Use SUCCEEDED to handle S_FALSE case
`SUCCEEDED` covers cases of `S_FALSE` returned from [`CoInitializeEx`](https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-coinitializeex).
1 parent 0cc8907 commit 0156612

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/parallel/concrt/codesnippet/CPP/walkthrough-using-the-concurrency-runtime-in-a-com-enabled-application_3.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class CCoInitializer
88
{
99
// Initialize the COM library on the current thread.
1010
HRESULT hr = CoInitializeEx(NULL, dwCoInit);
11-
if (hr == S_OK)
11+
if (SUCCEEDED(hr))
1212
_coinitialized = true;
1313
}
1414
~CCoInitializer()
@@ -24,4 +24,4 @@ class CCoInitializer
2424
// Hide copy constructor and assignment operator.
2525
CCoInitializer(const CCoInitializer&);
2626
CCoInitializer& operator=(const CCoInitializer&);
27-
};
27+
};

0 commit comments

Comments
 (0)