Returning GetLastError() as HRESULT

If I want to return a Win32 API error code (from GetLastError()) as a HRESULT, is this the correct way:

return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, GetLastError());
LVL 4
piano_boxerAsked:
Who is Participating?
 
alexoConnect With a Mentor Commented:
Use the HRESULT_FROM_WIN32() macro defined in <winerror.h> (it is automatically included as part of <windows.h>
0
 
piano_boxerAuthor Commented:
Thanks.
0
All Courses

From novice to tech pro — start learning today.