-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRemoteConsole.cpp
104 lines (96 loc) · 2.01 KB
/
RemoteConsole.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include "stdafx.h"
#include "Axis2.h"
#include "Axis2Dlg.h"
#include "RemoteConsole.h"
#include "RemoteConsoleLoginDlg.h"
CRemoteConsole::CRemoteConsole(HWND hWndParent)
{
Main->m_DlgGeneral->m_pRConsole = this;
this->m_parentHWnd = hWndParent;
m_bCommandPending = false;
m_bIsConnected = false;
m_bIsInitialized = false;
m_bIsAlive = false;
m_bContinue = true;
m_csCommand = "";
m_dwThreadID = 0;
m_csPort = "";
m_csAddress = "";
m_csAccount = "";
m_csPassword = "";
CString csSavePath;
// Try to find out where to connect to
CRemoteConsoleLoginDlg dlg;
if ( dlg.DoModal() != IDOK )
return;
m_csAddress = dlg.csAddress;
m_csPort = dlg.csPort;
// check the IP
if ((m_csAddress == "")||(m_csPort == ""))
{
AfxMessageBox(CMsg(_T("IDS_ERROR_NOIP")), MB_OK | MB_ICONEXCLAMATION);
return;
}
m_csAccount = dlg.csAccount;
m_csPassword = dlg.csPassword;
m_pThread = AfxBeginThread(&MainThread, this);
while (!m_bIsInitialized)
Sleep(50);
return;
}
CRemoteConsole::~CRemoteConsole()
{
/*m_bContinue = false;
int i = 0;
while ( m_bIsAlive && i < 100)
{
Sleep(100);
i++;
}
Main->m_DlgGeneral->m_pRConsole = NULL;*/
}
void CRemoteConsole::Broadcast(CString csMessage)
{
/*this->m_csCommand.Format(_T("B %s%c"), csMessage, 0x0d);
this->m_bCommandPending = true;
if (this->IsConnected())
{
int i = 0;
while(this->m_bCommandPending && i < 100)
{
Sleep(100);
i++;
}
}*/
}
void CRemoteConsole::Reconnect()
{
/*this->m_bContinue = true;
m_pThread = AfxBeginThread(&MainThread, this);
while (!m_bIsInitialized)
Sleep(50);
int i = 0;
while (!m_bIsConnected)
{
Sleep(50);
i++;
if ( i > 10 )
break;
}
if ( m_bIsConnected && m_parentHWnd != NULL)
SendMessage(m_parentHWnd, WM_RCONSOLERECONNECT, (WPARAM) this, 0);*/
}
void CRemoteConsole::Command(CString csMessage)
{
/*this->m_csCommand.Format(_T("%s%c"), csMessage, 0x0d);
this->m_bCommandPending = true;
if (this->IsConnected())
{
int i = 0;
while(this->m_bCommandPending && i < 100)
{
Sleep(100);
i++;
}
}*/
}