⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialoguser.cpp

📁 局域网聊天程序.rar
💻 CPP
字号:
// DialogUser.cpp : implementation file
//

#include "stdafx.h"
#include "MyNetChat.h"
#include "MyNetChatDlg.h"
#include "DialogUser.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDialogUser dialog


CDialogUser::CDialogUser(CWnd* pParent /*=NULL*/)
	: CDialog(CDialogUser::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDialogUser)
	//}}AFX_DATA_INIT
}


void CDialogUser::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialogUser)
	DDX_Control(pDX, IDC_USERDLG, m_aduser);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialogUser, CDialog)
	//{{AFX_MSG_MAP(CDialogUser)
	ON_BN_CLICKED(IDOK, OnAdduser)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialogUser message handlers
void CDialogUser::OnAdduser() 
{
	// TODO: Add my friends
	CString Usertext;
	char  *lpsztext=NULL;
	CString nitemstr;
	int nitem;
    m_aduser.GetWindowText(Usertext);
	CMyNetChatDlg *MainDlg=(CMyNetChatDlg*)AfxGetApp()->m_pMainWnd;
	nitem=::GetPrivateProfileInt("UserName","NCount",0,".\\MyNetChat.ini");
	MainDlg->m_List.GetItemText(0,0,lpsztext,sizeof(lpsztext));
    if(lpsztext!=NULL)
	{
     nitem++;
	}
	nitemstr.Format("%d",nitem);
	AfxMessageBox(lpsztext);
	AfxMessageBox(nitemstr);
	MainDlg->m_List.InsertItem(nitem,Usertext,0);
	::WritePrivateProfileString("UserName","Name"+nitemstr,Usertext,".\\MyNetChat.ini");
	::WritePrivateProfileString("UserName","NCount",nitemstr,".\\MyNetChat.ini");
	OnOK();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -