Solved

What Includes are required for these functions?

Posted on 2006-11-24
3
215 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to echo 6 115
Annoying "thing" blocks my view 4 130
Way to decrease size of apk file 9 104
Problem to App 4 116
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

713 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