#include <stdio.h>
#include <windows.h>
Go to the source code of this file.
Defines | |
| #define | SPRTF _snprintf |
| sprintf for various compiler versions. | |
| #define | MAX_STRLEN 127 |
| Proposed maximum string length for messages. | |
Functions | |
| LPCTSTR | getStrRes (UINT aResID, LPTSTR theBuf, int aMaxLen) |
| Retrieves a string from a string resource. | |
| void | prtMsg (HWND aHWND, LPCTSTR aTitle, UINT flags, LPCTSTR anFmt,...) |
| Prints a formatted message in a message box. | |
| LPCTSTR | errMsg (LPTSTR theBuf, size_t aMaxLen, UINT anMsgID, HRESULT aSysErr) |
| Creates an error message string. | |
| void | prtErr (HWND aHWND, UINT aTitID, UINT anMsgID, HRESULT aSysErr) |
| Prints an error message in a message box. | |
| void | prtInfo (HWND aHWND, UINT aTitID, UINT anMsgID) |
| Prints the given informational message in a message box. | |
| #define MAX_STRLEN 127 |
Proposed maximum string length for messages.
| #define SPRTF _snprintf |
sprintf for various compiler versions.
| LPCTSTR errMsg | ( | LPTSTR | theBuf, | |
| size_t | aMaxLen, | |||
| UINT | anMsgID, | |||
| HRESULT | aSysErr | |||
| ) |
Creates an error message string.
| theBuf | the buffer, where to put the resulting error messae. | |
| aMaxLen | size of the buffer pointed by theBuf. In fact the buffer pointed by theBuf must be able to hold at least aMaxLen+1 characters because of the trailing 0. | |
| anMsgID | ID of the resource string for the error description. | |
| aSysErr | system error code, eg. result of GetLastError(). |
| LPCTSTR getStrRes | ( | UINT | aResID, | |
| LPTSTR | theBuf, | |||
| int | aMaxLen | |||
| ) |
Retrieves a string from a string resource.
| aResID | the resource ID. | |
| theBuf | pointer to the buffer, where to put the resulting string. | |
| aMaxLen | the maximum number of characters to put to theBuf. In fact theBuf must be able to hold at least aMaxLen+1 characters because of the trailing 0. |
| void prtErr | ( | HWND | aHWND, | |
| UINT | aTitID, | |||
| UINT | anMsgID, | |||
| HRESULT | aSysErr | |||
| ) |
Prints an error message in a message box.
Prints the given message and the message resulting from the given system error in a message box, the system error message string is retrieved using FormatMessage().
| aHWND | handle of the window for which to print the message. | |
| aTitID | resource string ID for the title of the message box. | |
| anMsgID | resource string ID fot the mesage to print in the message box. | |
| aSysErr | the windows system error code, eg. code resulting from GetLastError(). |
| void prtInfo | ( | HWND | aHWND, | |
| UINT | aTitID, | |||
| UINT | anMsgID | |||
| ) |
Prints the given informational message in a message box.
| aHWND | handle of the window for which to print the message. | |
| aTitID | resource string ID for the title of the message box. | |
| anMsgID | resource string ID fot the mesage to print in the message box. |
| void prtMsg | ( | HWND | aHWND, | |
| LPCTSTR | aTitle, | |||
| UINT | flags, | |||
| LPCTSTR | anFmt, | |||
| ... | ||||
| ) |
Prints a formatted message in a message box.
| aHWND | handle of the window for which to print the message. | |
| aTitle | title of the message box window. | |
| flags | message box flags, eg. MB_OK, MB_ICONERROR, etc. | |
| anFmt | printf-line format of the message to print. |
1.5.6