📄 chscwiz.cpp
字号:
void ChShortcutWizServer::DoDataExchange( CDataExchange* pDX )
{
ChWizardPage::DoDataExchange( pDX );
//{{AFX_DATA_MAP(ChShortcutWizServer)
DDX_Control(pDX, IDC_EDIT_PORT, m_editPort);
DDX_Control(pDX, IDC_EDIT_HOST, m_editHost);
DDX_Control(pDX, IDC_COMBO_TYPES, m_comboTypes);
DDX_CBString(pDX, IDC_COMBO_TYPES, m_strType);
DDX_Text(pDX, IDC_EDIT_HOST, m_strHost);
DDX_Text(pDX, IDC_EDIT_PORT, m_iPort);
//}}AFX_DATA_MAP
if (pDX->m_bSaveAndValidate)
{
if ( 0 == m_strType.GetLength()
&& m_comboTypes.GetCurSel() != CB_ERR )
{ // GetWindowText does not work under Win32s
// On Win32s try getting data based on the selection
m_comboTypes.GetLBText( m_comboTypes.GetCurSel(), m_strType );
}
if (m_strType.GetLength())
{
m_type.Set( m_strType );
}
else
{
m_type = undefinedType;
}
}
else
{
if (m_type == undefinedType)
{
m_comboTypes.SetCurSel( -1 );
}
else
{
string strType = m_type.GetName();
int iResult;
iResult = m_comboTypes.SelectString( -1, strType );
}
}
}
BEGIN_MESSAGE_MAP( ChShortcutWizServer, ChWizardPage )
//{{AFX_MSG_MAP(ChShortcutWizServer)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*----------------------------------------------------------------------------
ChShortcutWizServer protected methods
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
ChShortcutWizServer message handlers
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
ChShortcutWizUsername class
----------------------------------------------------------------------------*/
IMPLEMENT_DYNCREATE( ChShortcutWizUsername, ChWizardPage )
ChShortcutWizUsername::ChShortcutWizUsername() :
ChWizardPage( ChShortcutWizUsername::IDD ),
m_type( undefinedType )
{
//{{AFX_DATA_INIT(ChShortcutWizUsername)
m_strPassword = _T("");
m_strUsername = _T("");
m_iLoginStyle = -1;
//}}AFX_DATA_INIT
m_loginType = variableLogin;
}
ChShortcutWizUsername::~ChShortcutWizUsername()
{
}
bool ChShortcutWizUsername::OnInitPage()
{
bool boolSetFocus = ChWizardPage::OnInitPage();
m_editUsername.LimitText( constUsernameLimit );
m_editPassword.LimitText( constPasswordLimit );
return boolSetFocus;
}
void ChShortcutWizUsername::DoDataExchange( CDataExchange* pDX )
{
ChWizardPage::DoDataExchange( pDX );
//{{AFX_DATA_MAP(ChShortcutWizUsername)
DDX_Control(pDX, IDC_STATIC_LOGIN_STYLE, m_staticLoginStyle);
DDX_Control(pDX, IDC_RADIO_LOGIN_MUD, m_radioMudLogin);
DDX_Control(pDX, IDC_RADIO_LOGIN_CONNECT, m_radioConnectLogin);
DDX_Control(pDX, IDC_SHORTCUT_PASSWORD, m_editPassword);
DDX_Control(pDX, IDC_SHORTCUT_USERNAME, m_editUsername);
DDX_Text(pDX, IDC_SHORTCUT_PASSWORD, m_strPassword);
DDX_Text(pDX, IDC_SHORTCUT_USERNAME, m_strUsername);
DDX_Radio(pDX, IDC_RADIO_LOGIN_MUD, m_iLoginStyle);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP( ChShortcutWizUsername, ChWizardPage )
//{{AFX_MSG_MAP(ChShortcutWizUsername)
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*----------------------------------------------------------------------------
ChShortcutWizUsername message handlers
----------------------------------------------------------------------------*/
void ChShortcutWizUsername::OnShowWindow( BOOL boolShow, UINT nStatus )
{
ChWizardPage::OnShowWindow( boolShow, nStatus );
if (boolShow)
{
ChShortcutWizard* pWiz = (ChShortcutWizard*)GetParent();
string strHost;
chint16 sPort;
ChWorldType type;
ASSERT( pWiz );
pWiz->GetServer( strHost, sPort, type );
if (type != m_type)
{ // Type has changed
m_type = type;
if (variableLogin == m_loginType)
{
m_loginType = m_type.GetLoginType();
}
if (connectLogin == m_loginType)
{
m_iLoginStyle = 1;
}
else
{
m_iLoginStyle = 0;
}
/* If the server type allows
variable login, then allow
them to change it */
if (variableLogin == type.GetLoginType())
{
m_staticLoginStyle.ShowWindow( SW_SHOW );
m_radioMudLogin.ShowWindow( SW_SHOW );
m_radioConnectLogin.ShowWindow( SW_SHOW );
}
else
{
m_staticLoginStyle.ShowWindow( SW_HIDE );
m_radioMudLogin.ShowWindow( SW_HIDE );
m_radioConnectLogin.ShowWindow( SW_HIDE );
}
UpdateData( false );
}
}
}
/*----------------------------------------------------------------------------
ChShortcutWizOptions class
----------------------------------------------------------------------------*/
IMPLEMENT_DYNCREATE( ChShortcutWizOptions, ChWizardPage )
ChShortcutWizOptions::ChShortcutWizOptions() :
ChWizardPage( ChShortcutWizOptions::IDD )
{
//{{AFX_DATA_INIT(ChShortcutWizOptions)
m_strGroup = _T("");
//}}AFX_DATA_INIT
}
ChShortcutWizOptions::~ChShortcutWizOptions()
{
}
bool ChShortcutWizOptions::OnInitPage()
{
bool boolSetFocus = ChWizardPage::OnInitPage();
if (ChUtil::GetSystemType() == CH_SYS_WIN95)
{
SetupForProgman();
}
else
{
SetupForProgman();
}
return boolSetFocus;
}
void ChShortcutWizOptions::DoDataExchange( CDataExchange* pDX )
{
ChWizardPage::DoDataExchange( pDX );
//{{AFX_DATA_MAP(ChShortcutWizOptions)
DDX_Control(pDX, IDC_SHORTCUT_FOLDER, m_comboShortcutFolder);
DDX_Control(pDX, IDC_SHORTCUT_MSG, m_staticShortcutMsg);
DDX_CBString(pDX, IDC_SHORTCUT_FOLDER, m_strGroup);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP( ChShortcutWizOptions, ChWizardPage )
//{{AFX_MSG_MAP(ChShortcutWizOptions)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*----------------------------------------------------------------------------
ChShortcutWizOptions protected methods
----------------------------------------------------------------------------*/
void ChShortcutWizOptions::SetupForProgman()
{
DWORD idDDEInst = ChCore::GetDDEInstance();
HCONV hDDEConversation;
HSZ hszService;
HSZ hszTopic;
HSZ hszRequest;
HDDEDATA hProgData;
char* pstrData;
/* Get a list of program manager
groups (via DDE) and add them
to the combo box */
hszService = DdeCreateStringHandle( idDDEInst, PROGMAN_SERVICE,
CP_WINANSI );
hszTopic = DdeCreateStringHandle( idDDEInst, PROGMAN_TOPIC,
CP_WINANSI );
// Initiate a conversation
hDDEConversation = DdeConnect( idDDEInst, hszService, hszTopic, 0 );
// Send the request to the server
hszRequest = DdeCreateStringHandle( idDDEInst, "GROUPS", CP_WINANSI );
hProgData = DdeClientTransaction( 0, 0, hDDEConversation, hszRequest,
CF_TEXT, XTYP_REQUEST, 5000, 0 );
// Lock the returned data
pstrData = (char*)DdeAccessData( hProgData, 0 );
/* Now parse the returned data,
adding each item to the list */
string strData( pstrData );
string strGroup;
int iIndex;
while (!strData.IsEmpty())
{
iIndex = strData.Find( '\r' );
if (iIndex == -1)
{
strGroup = strData;
strData = "";
}
else
{
int iTrim = 0;
strGroup = strData.Left( iIndex );
strData = strData.Mid( iIndex + 1 );
while ((iTrim < strData.GetLength()) && isspace( strData[iTrim] ))
{
iTrim++;
}
strData = strData.Mid( iTrim );
}
// Add the item
m_comboShortcutFolder.AddString( strGroup );
}
// Unlock the data
DdeUnaccessData( hProgData );
// Clean up from DDE
DdeFreeStringHandle( idDDEInst, hszService );
DdeFreeStringHandle( idDDEInst, hszTopic );
DdeFreeStringHandle( idDDEInst, hszRequest );
// Now select an appropriate choice
string strAppName;
LOADSTRING( IDS_APP_NAME, strAppName );
iIndex = m_comboShortcutFolder.FindString( -1, strAppName );
if (CB_ERR == iIndex)
{ /* The group beginning with the
app name wasn't found, so add
an option for the user */
string strGroup;
LOADSTRING( IDS_GROUP_NAME, strGroup );
iIndex = m_comboShortcutFolder.AddString( strGroup );
}
if (CB_ERR != iIndex)
{
m_comboShortcutFolder.SetCurSel( iIndex );
}
else
{
m_comboShortcutFolder.SetCurSel( -1 );
}
}
/*----------------------------------------------------------------------------
ChShortcutWizOptions message handlers
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
ChShortcutWizFinish class
----------------------------------------------------------------------------*/
IMPLEMENT_DYNCREATE( ChShortcutWizFinish, ChWizardPage )
ChShortcutWizFinish::ChShortcutWizFinish() :
ChWizardPage( ChShortcutWizFinish::IDD )
{
//{{AFX_DATA_INIT(ChShortcutWizFinish)
//}}AFX_DATA_INIT
}
ChShortcutWizFinish::~ChShortcutWizFinish()
{
}
bool ChShortcutWizFinish::OnInitPage()
{
bool boolSetFocus = ChWizardPage::OnInitPage();
ChShortcutWizard* pWizard = (ChShortcutWizard*)GetParent();
if (ChUtil::GetSystemType() == CH_SYS_WIN95)
{
string strPath;
string strFilePath;
string strGroupName;
string strName;
string strFormat;
string strData;
pWizard->GetData( strGroupName, strName );
LOADSTRING( IDS_SHORTCUT_FINISH_WIN95, strFormat );
strData.Format( strFormat, (const char*)strName,
(const char*)strGroupName,
(const char*)strGroupName );
m_staticFinishSysMsg.SetWindowText( strData );
}
else
{
string strPath;
string strFilePath;
string strGroupName;
string strName;
string strFormat;
string strData;
pWizard->GetData( strGroupName, strName );
LOADSTRING( IDS_SHORTCUT_FINISH_PROGMAN, strFormat );
strData.Format( strFormat, (const char*)strName,
(const char*)strGroupName );
m_staticFinishSysMsg.SetWindowText( strData );
}
return boolSetFocus;
}
void ChShortcutWizFinish::DoDataExchange( CDataExchange* pDX )
{
ChWizardPage::DoDataExchange( pDX );
//{{AFX_DATA_MAP(ChShortcutWizFinish)
DDX_Control(pDX, IDC_SHORTCUT_MSG_SYSTEM, m_staticFinishSysMsg);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP( ChShortcutWizFinish, ChWizardPage )
//{{AFX_MSG_MAP(ChShortcutWizFinish)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*----------------------------------------------------------------------------
ChShortcutWizFinish message handlers
----------------------------------------------------------------------------*/
#endif // defined( CH_MSW )
// Local Variables: ***
// tab-width:4 ***
// End: ***
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -