修改三方通话功能,在发起三方通话时,先保持住主叫,然后再拉回主叫到会议

StableCore.cpp 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // StableCore.cpp : 定义应用程序的类行为。
  2. //
  3. #include "stdafx.h"
  4. #include "StableCore.h"
  5. #include "DisplayWnd.h"
  6. #include "ControlShell.h"
  7. #include "MsgCenter.h"
  8. #include "ExceptionHandler.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #endif
  12. LONG WINAPI AppUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo)
  13. {
  14. RecordExceptionInfo(ExceptionInfo, "StableCore");
  15. return EXCEPTION_EXECUTE_HANDLER;
  16. }
  17. // CStableCoreApp
  18. BEGIN_MESSAGE_MAP(CStableCoreApp, CWinApp)
  19. ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
  20. END_MESSAGE_MAP()
  21. // CStableCoreApp 构造
  22. CStableCoreApp::CStableCoreApp()
  23. {
  24. // 支持重新启动管理器
  25. m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
  26. // TODO: 在此处添加构造代码,
  27. // 将所有重要的初始化放置在 InitInstance 中
  28. SetUnhandledExceptionFilter(AppUnhandledExceptionFilter);
  29. }
  30. // 唯一的一个 CStableCoreApp 对象
  31. CStableCoreApp theApp;
  32. // CStableCoreApp 初始化
  33. BOOL CStableCoreApp::InitInstance()
  34. {
  35. #ifndef _DEBUG
  36. SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX);
  37. #endif
  38. // 禁止多个实例的同时运行
  39. HANDLE hMutexOneInstance = ::CreateMutex(NULL, TRUE, _T(AfxGetAppName()));
  40. if(::GetLastError() == ERROR_ALREADY_EXISTS)
  41. {
  42. if(hMutexOneInstance) // Release the mutex
  43. {
  44. ::ReleaseMutex(hMutexOneInstance);
  45. }
  46. #ifdef _SC_UI_MODE
  47. HWND hWndPrevious = ::GetWindow(::GetDesktopWindow(), GW_CHILD);
  48. while(::IsWindow(hWndPrevious))
  49. {
  50. // 检查窗口是否有预设的标记? 有,则是我们寻找的主窗口
  51. if(::GetProp(hWndPrevious, m_pszAppName))
  52. {
  53. // 主窗口已最小化,则恢复其大小
  54. if(::IsIconic(hWndPrevious)) ::ShowWindow(hWndPrevious, SW_RESTORE);
  55. ::SetForegroundWindow(hWndPrevious); // 将主窗激活
  56. ::SetForegroundWindow(::GetLastActivePopup(hWndPrevious)); // 将主窗的对话框激活
  57. return FALSE;
  58. } // end if
  59. hWndPrevious = ::GetWindow(hWndPrevious, GW_HWNDNEXT); // 继续寻找下一个窗口
  60. } // end while
  61. #else
  62. return FALSE;
  63. #endif
  64. } // end if
  65. // 如果一个运行在 Windows XP 上的应用程序清单指定要
  66. // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
  67. //则需要 InitCommonControlsEx()。否则,将无法创建窗口。
  68. INITCOMMONCONTROLSEX InitCtrls;
  69. InitCtrls.dwSize = sizeof(InitCtrls);
  70. // 将它设置为包括所有要在应用程序中使用的
  71. // 公共控件类。
  72. InitCtrls.dwICC = ICC_WIN95_CLASSES;
  73. InitCommonControlsEx(&InitCtrls);
  74. CWinApp::InitInstance();
  75. if (!AfxSocketInit())
  76. {
  77. AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
  78. return FALSE;
  79. }
  80. AfxEnableControlContainer();
  81. // 标准初始化
  82. // 如果未使用这些功能并希望减小
  83. // 最终可执行文件的大小,则应移除下列
  84. // 不需要的特定初始化例程
  85. // 更改用于存储设置的注册表项
  86. // TODO: 应适当修改该字符串,
  87. // 例如修改为公司或组织名
  88. SetRegistryKey(_T("StableCore"));
  89. #ifdef _SC_UI_MODE
  90. if(!CControlShell::GetInstance().stage1Start())
  91. return FALSE;
  92. CDisplayWnd* pDisWnd = (CDisplayWnd *)RUNTIME_CLASS(CDisplayWnd)->CreateObject();
  93. m_pMainWnd = pDisWnd;
  94. pDisWnd->Show();
  95. CControlShell::GetInstance().stage2Start();
  96. return TRUE;
  97. #else
  98. if(!CControlShell::GetInstance().startDirectly())
  99. return FALSE;
  100. CMsgCenter::GetInstance().startMsgPump();
  101. return FALSE;
  102. #endif
  103. }