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.

100 lines
2.1 KiB

  1. /*************************************************************************
  2. **
  3. ** OLE 2 Sample Code
  4. **
  5. ** debug.c
  6. **
  7. ** This file contains some functions for debugging support
  8. **
  9. ** (c) Copyright Microsoft Corp. 1992 - 1993 All Rights Reserved
  10. **
  11. *************************************************************************/
  12. #include "outline.h"
  13. OLEDBGDATA
  14. extern LPOUTLINEAPP g_lpApp;
  15. void SetDebugLevelCommand(void)
  16. {
  17. char szBuf[80];
  18. HWND hWndFrame = OutlineApp_GetFrameWindow(g_lpApp);
  19. wsprintf(szBuf, "%d", OleDbgGetDbgLevel());
  20. if (InputTextDlg(hWndFrame, szBuf, "Debug Level [0-4]")) {
  21. switch (szBuf[0]) {
  22. case '0':
  23. OleDbgSetDbgLevel(0);
  24. break;
  25. case '1':
  26. OleDbgSetDbgLevel(1);
  27. break;
  28. case '2':
  29. OleDbgSetDbgLevel(2);
  30. break;
  31. case '3':
  32. OleDbgSetDbgLevel(3);
  33. break;
  34. case '4':
  35. OleDbgSetDbgLevel(4);
  36. break;
  37. default:
  38. OutlineApp_ErrorMessage(g_lpApp, "Valid Debug Level Range: 0-4");
  39. break;
  40. }
  41. }
  42. }
  43. #if defined( OLE_VERSION )
  44. /* InstallMessageFilterCommand
  45. * ---------------------------
  46. *
  47. * Handles the "Install Message Filter" menu item. If a message filter is
  48. * already installed, this function de-installs it. If there is not one
  49. * already installed, this function installs one.
  50. *
  51. */
  52. void InstallMessageFilterCommand(void)
  53. {
  54. LPOLEAPP lpOleApp = (LPOLEAPP)g_lpApp;
  55. /*
  56. ** Check to see if we've already installed a MessageFilter.
  57. ** If so, uninstall it.
  58. */
  59. if (lpOleApp->m_lpMsgFilter != NULL)
  60. OleApp_RevokeMessageFilter(lpOleApp);
  61. else
  62. OleApp_RegisterMessageFilter(lpOleApp);
  63. }
  64. /* RejectIncomingCommand
  65. * ---------------------
  66. *
  67. * Toggles between rejecting and not-handling in coming LRPC calls
  68. *
  69. */
  70. void RejectIncomingCommand(void)
  71. {
  72. DWORD dwOldStatus;
  73. DWORD dwNewStatus;
  74. LPOLEAPP lpOleApp = (LPOLEAPP)g_lpApp;
  75. dwOldStatus = OleStdMsgFilter_GetInComingCallStatus(lpOleApp->m_lpMsgFilter);
  76. if (dwOldStatus == SERVERCALL_RETRYLATER)
  77. dwNewStatus = SERVERCALL_ISHANDLED;
  78. else
  79. dwNewStatus = SERVERCALL_RETRYLATER;
  80. OleStdMsgFilter_SetInComingCallStatus(lpOleApp->m_lpMsgFilter, dwNewStatus);
  81. }
  82. #endif // OLE_VERSION