ce/wintools.h File Reference

Various MS WIndows oriented functions and macros common for all programs. More...

#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.


Detailed Description

Various MS WIndows oriented functions and macros common for all programs.

Author:
Daniel Stoinski
Version:
$Revision$

Define Documentation

#define MAX_STRLEN   127

Proposed maximum string length for messages.

#define SPRTF   _snprintf

sprintf for various compiler versions.


Function Documentation

LPCTSTR errMsg ( LPTSTR  theBuf,
size_t  aMaxLen,
UINT  anMsgID,
HRESULT  aSysErr 
)

Creates an error message string.

Parameters:
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().
Returns:
theBuf.

LPCTSTR getStrRes ( UINT  aResID,
LPTSTR  theBuf,
int  aMaxLen 
)

Retrieves a string from a string resource.

Parameters:
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.
Returns:
theBuf or NULL in any case of errors.

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().

Parameters:
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.

Parameters:
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.

Parameters:
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.


Generated on Mon Jul 12 14:51:51 2010 for cetoys by  doxygen 1.5.6