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.

50 lines
1.9 KiB

  1. #include "precomp.h"
  2. #pragma hdrstop
  3. /**************************************************************************/
  4. /***** Common Library Component - Extended Message Box routine ************/
  5. /**************************************************************************/
  6. /*
  7. ** Purpose:
  8. ** To load strings from the string table and use them to display a
  9. ** message box.
  10. ** Arguments:
  11. ** hInstance: identifies an instance of the module whose executable
  12. ** file contains the string resource.
  13. ** hwndParent: identifies the window handle that owns the message box
  14. ** idsText: the identifier that identifies the string from the string
  15. ** table that contains the message to be displayed. This
  16. ** string must be less than 256 characters in length.
  17. ** idsCaption: identifies the string from the string table that contains
  18. ** the string that will be used as the caption. This caption
  19. ** must be less than 1024 characters in length. if idsCaption
  20. ** is NULL the caption "Error" will be used.
  21. ** wType: specifies the contents of the message box. See table
  22. ** 4.11 "Message Box Types" in the Win 3.0 SDK Documentation.
  23. ** Returns: IDABORT, IDCANCEL, IDIGNORE, IDNO, IDOK, IDRETRY, or
  24. ** IDYES. See the MessageBox return values in the Win 3.0
  25. ** SDK docs.
  26. ****************************************************************************/
  27. int APIENTRY ExtMessageBox(HANDLE hInstance, HWND hwndParent,
  28. WORD idsText, WORD idsCaption, WORD wType)
  29. {
  30. CHL szText[1024];
  31. CHL szCaption[256];
  32. int iRet;
  33. HWND hwndSav;
  34. ChkArg(hInstance , 1, -1);
  35. ChkArg(hwndParent, 2, -1);
  36. ChkArg(idsText , 3, -1);
  37. EvalAssert(LoadString(hInstance, idsText, (LPSTR)szText, 1024));
  38. EvalAssert(LoadString(hInstance, idsCaption, (LPSTR)szCaption, 256));
  39. hwndSav = GetFocus();
  40. iRet = MessageBox(hwndParent, (LPSTR)szText, (LPSTR)szCaption, wType);
  41. SetFocus(hwndSav);
  42. SendMessage(hwndParent, WM_NCACTIVATE, 1, 0L);
  43. return(iRet);
  44. }