Solved

What Includes are required for these functions?

Posted on 2006-11-24
3
214 Views
Last Modified: 2013-11-20
Hi guys,

I have these functions:

ShowError(GetSystemErrorMessage(hr))


What is needed to be included for me to make use of them?

Cheers!
0
Comment
Question by:Cyber-Drugs
3 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 18009104
These functions are not part of Microsoft libraries. They should be part of the project you are wotking with - possibly some sample project.
GetSystemErrorMessage(hr) looks like function which converts HRESULT to text error message. This is my function I use for this:

CString GetErrorMessageFromErrorCode(DWORD dwErrorCode)
{
    void* pMsgBuf = NULL;

    ::FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        dwErrorCode,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR) &pMsgBuf,
        0,
        NULL);

    CString result;
   
    if ( pMsgBuf )
    {
        result = (LPTSTR) pMsgBuf;
        LocalFree(pMsgBuf);
    }

    if ( result.IsEmpty() )
        result = _T("Unexpected error");

    return result;
}

ShowError can be function which shows MessageBox, writes output to Console screen, writes to log file etc. Something like this:

void ShowError(LPCTSTR message)
{
    ::MessageBox(NULL, message, _T("Error"), MB_OK);
}
0
 
LVL 86

Expert Comment

by:jkr
ID: 18009111
Neither of these functions is Windows or MFC, so that's hard to tell...
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18009199
Hi guys,

Seems those are the ones I am after, and sorry about that, I took bits and pieces of projects and strung them together to give me what I wanted, and now cleaning up the bugs. Working now, cheers! :)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

790 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