Solved

What Includes are required for these functions?

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

728 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