Solved

Returning GetLastError() as HRESULT

Posted on 1999-01-11
2
1,659 Views
Last Modified: 2013-12-03
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());
0
Comment
Question by:piano_boxer
2 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 50 total points
ID: 1418482
Use the HRESULT_FROM_WIN32() macro defined in <winerror.h> (it is automatically included as part of <windows.h>
0
 
LVL 4

Author Comment

by:piano_boxer
ID: 1418483
Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now