Re: FormatMessage and WSAGetLastError



On Thu, 18 Dec 2008 08:53:01 -0800, Fabio Sobral
<FabioSobral@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hi.

I'm having a problem with FormatMessage and error codes from WSAGetLastError.
I tested the same code in a WM5 and a WM6 device, and FormatMessage failed
on both. Using GetLastError after FormatMessage I get 317 - "The system
cannot find message text for message number 0x%1 in the message file for %2."

Older versions of Windows CE provided _no_ messages, so FormatMessage
was useless and error 317 was common.


Can I really use FormatMessage with error codes that are not from
GetLastError?
If so, what would be the problem?

I'm doing something like this:

void getErrorMessage(int errorCode, TCHAR* buffer, int32 size)
{
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_IGNORE_INSERTS,
null, errorCode, 0, buffer, size, null));
}

If everything is fine, maybe the devices lack this part of the system
message-table. What can I do in this case?

I build a generic message that gives the error number and says no
further info is available. I also include info I gather (e.g., that my
program was trying to open a file called blah).


Thanks

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 400
Boston, MA 02116
www.penfact.com
.



Relevant Pages

  • Re: FormatMessage and WSAGetLastError
    ... I tested the same code in a WM5 and a WM6 device, and FormatMessage ... Older versions of Windows CE provided _no_ messages, ... Can I really use FormatMessage with error codes that are not from ... void getErrorMessage(int errorCode, TCHAR* buffer, int32 size) ...
    (microsoft.public.windowsce.app.development)
  • Re: FormatMessage and WSAGetLastError
    ... I'm having a problem with FormatMessage and error codes from WSAGetLastError. ... void getErrorMessage(int errorCode, TCHAR* buffer, int32 size) ...
    (microsoft.public.windowsce.app.development)
  • FormatMessage and WSAGetLastError
    ... I'm having a problem with FormatMessage and error codes from WSAGetLastError. ... I tested the same code in a WM5 and a WM6 device, ... void getErrorMessage(int errorCode, TCHAR* buffer, int32 size) ...
    (microsoft.public.windowsce.app.development)
  • howto use FormatMessage for wmsdk error codes
    ... I would like to use FormatMessage to turn the WMSDK error codes into message strings. ... DWORD err = GetLastError; ...
    (microsoft.public.win32.programmer.directx.video)

Loading