ConnectDlg.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // ConnectDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "AutoRun.h"
  5. #include "ConnectDlg.h"
  6. #include "ClientTunnel.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CConnectDlg dialog
  14. CConnectDlg::CConnectDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(CConnectDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CConnectDlg)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. }
  21. void CConnectDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(CConnectDlg)
  25. // NOTE: the ClassWizard will add DDX and DDV calls here
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(CConnectDlg, CDialog)
  29. //{{AFX_MSG_MAP(CConnectDlg)
  30. ON_WM_TIMER()
  31. ON_WM_CLOSE()
  32. ON_WM_DESTROY()
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CConnectDlg message handlers
  37. void CConnectDlg::OnOK()
  38. {
  39. // TODO: Add extra validation here
  40. }
  41. void CConnectDlg::OnCancel()
  42. {
  43. // TODO: Add extra cleanup here
  44. }
  45. HWND g_hConnectWnd = NULL;
  46. BOOL CConnectDlg::OnInitDialog()
  47. {
  48. CDialog::OnInitDialog();
  49. g_hConnectWnd = m_hWnd;
  50. // TODO: Add extra initialization here
  51. SetTimer(1, 100, NULL);
  52. return TRUE; // return TRUE unless you set the focus to a control
  53. // EXCEPTION: OCX Property Pages should return FALSE
  54. }
  55. void CConnectDlg::OnTimer(UINT nIDEvent)
  56. {
  57. // TODO: Add your message handler code here and/or call default
  58. try
  59. {
  60. KillTimer(nIDEvent);
  61. if (g_pMainWnd->OnConnectRemoteServer() == 0)
  62. {
  63. SetTimer(1, 1000, NULL); return;
  64. //::Sleep (1000);
  65. }
  66. g_bSendOK = 1; g_hConnectWnd = NULL;
  67. CDialog::OnCancel();
  68. }
  69. catch (...)
  70. {
  71. }
  72. }
  73. void CConnectDlg::OnClose()
  74. {
  75. // TODO: Add your message handler code here and/or call default
  76. try
  77. {
  78. KillTimer(1); g_hConnectWnd = NULL;
  79. CDialog::OnCancel();
  80. }
  81. catch (...)
  82. {
  83. }
  84. }
  85. void CConnectDlg::OnDestroy()
  86. {
  87. g_hConnectWnd = NULL;
  88. try
  89. {
  90. CDialog::OnDestroy();
  91. }
  92. catch (...)
  93. {
  94. }
  95. // TODO: Add your message handler code here
  96. }