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.

52 lines
1.3 KiB

  1. // PromptUser.cpp -- definition of utility to prompt the user for a response.
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 2000. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #include "stdafx.h"
  8. #include <string>
  9. #include <scuOsExc.h>
  10. #include "StResource.h"
  11. #include "CspProfile.h"
  12. #include "PromptUser.h"
  13. using namespace std;
  14. using namespace ProviderProfile;
  15. /////////////////////////// HELPER /////////////////////////////////
  16. int
  17. PromptUser(HWND hWnd,
  18. UINT uiResourceId,
  19. UINT uiStyle)
  20. {
  21. return PromptUser(hWnd, (LPCTSTR)StringResource(uiResourceId).AsCString(),
  22. uiStyle);
  23. }
  24. int
  25. PromptUser(HWND hWnd,
  26. LPCTSTR lpMessage,
  27. UINT uiStyle)
  28. {
  29. CString sTitle(CspProfile::Instance().Name());
  30. if (!((MB_SYSTEMMODAL | uiStyle) || (MB_APPLMODAL | uiStyle)))
  31. uiStyle |= MB_TASKMODAL;
  32. uiStyle |= MB_SETFOREGROUND | MB_TOPMOST;
  33. int iResponse = MessageBox(hWnd, lpMessage, (LPCTSTR)sTitle,
  34. uiStyle);
  35. if (0 == iResponse)
  36. throw scu::OsException(GetLastError());
  37. return iResponse;
  38. }