Leaked source code of windows server 2003
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.

46 lines
1.3 KiB

  1. #include <windows.h>
  2. #include "helpers.h"
  3. #include "res.h"
  4. extern HINSTANCE ghInstance;
  5. #define TITLESIZE 50
  6. WCHAR szTitle[TITLESIZE] = {0};
  7. WCHAR *pszMessage = NULL;
  8. #define MSGBUFFERSIZE 500
  9. BOOL PresentMessageBox(UINT uiMessageID,UINT uiType)
  10. {
  11. if (NULL == ghInstance) return FALSE;
  12. if (szTitle[0] == 0)
  13. {
  14. LoadString(ghInstance, IDS_ITGTITLE,szTitle,TITLESIZE);
  15. }
  16. pszMessage = (WCHAR *) CspAllocH(MSGBUFFERSIZE * sizeof(WCHAR));
  17. if (NULL == pszMessage) return FALSE;
  18. INT iRet = LoadString(ghInstance,uiMessageID,pszMessage,MSGBUFFERSIZE);
  19. if (iRet == 0) return FALSE;
  20. MessageBox(NULL,pszMessage,szTitle,uiType);
  21. CspFreeH((void *) pszMessage);
  22. return TRUE;
  23. }
  24. BOOL PresentModalMessageBox(HWND hw, UINT uiMessageID,UINT uiType)
  25. {
  26. if (NULL == ghInstance) return FALSE;
  27. if (szTitle[0] == 0)
  28. {
  29. LoadString(ghInstance, IDS_ITGTITLE,szTitle,TITLESIZE);
  30. }
  31. pszMessage = (WCHAR *) CspAllocH(MSGBUFFERSIZE * sizeof(WCHAR));
  32. if (NULL == pszMessage) return FALSE;
  33. INT iRet = LoadString(ghInstance,uiMessageID,pszMessage,MSGBUFFERSIZE);
  34. if (iRet == 0) return FALSE;
  35. MessageBox(hw,pszMessage,szTitle,uiType);
  36. CspFreeH((void *) pszMessage);
  37. return TRUE;
  38. }