?
Solved

What Includes are required for these functions?

Posted on 2006-11-24
3
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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:
Suggested Courses

765 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