Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.8 KiB

  1. /************************************************************************/
  2. /* */
  3. /* RCPP - Resource Compiler Pre-Processor for NT system */
  4. /* */
  5. /* GETMSG.C - Replaces NMSGHDR.ASM and MSGS.ASM */
  6. /* */
  7. /* 28-Nov-90 w-BrianM Created to remove need for MKMSG.EXE */
  8. /* */
  9. /************************************************************************/
  10. #include "rc.h"
  11. CHAR msgbuf[4096];
  12. /************************************************************************/
  13. /* GET_MSG - Given a message number, get the correct format string */
  14. /************************************************************************/
  15. PCHAR
  16. GET_MSG (
  17. int msgnumber
  18. )
  19. {
  20. int cb;
  21. cb = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_IGNORE_INSERTS,
  22. (HMODULE)hInstance, msgnumber, 0, msgbuf, 4096, NULL);
  23. if (cb)
  24. return msgbuf;
  25. else {
  26. #if DBG
  27. printf("Internal error : message not found: %d\n", msgnumber);
  28. #endif
  29. return ("");
  30. }
  31. }
  32. /************************************************************************/
  33. /* SET_MSG - Given a format string, format it and store it in first parm*/
  34. /************************************************************************/
  35. void
  36. __cdecl
  37. SET_MSG (
  38. PCHAR exp,
  39. UINT n,
  40. PCHAR fmt,
  41. ...
  42. )
  43. {
  44. va_list arg_list;
  45. va_start (arg_list, fmt);
  46. FormatMessageA (FORMAT_MESSAGE_FROM_STRING, fmt, 0, 0,
  47. exp, n, &arg_list);
  48. va_end (arg_list);
  49. }