Solved

What Includes are required for these functions?

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 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

20 Experts available now in Live!

Get 1:1 Help Now