confignt.cpp

来自「winsail v2.0是用于DOS下的图形界面空间系统」· C++ 代码 · 共 161 行

CPP
161
字号
#include <Symbol.h>
#include <MyFrame.h>

extern BOOL       bAfxNetcard;
extern IP_ADDRESS mAfxIpSelfAddr;
extern IP_ADDRESS mAfxIpPeerAddr;
extern IP_ADDRESS mAfxIpMaskAddr;
extern IP_ADDRESS mAfxIpGatewayAddr;
extern ETHERNET_ADDRESS mAfxNICAddr;

void far NetcardSetting()
{
	char buf[256];

	//Create a Dialog On the Center of Desktop
	CDialog* pDialog = new CDialog;//分配实例
	pDialog->CreateWindow(0, 0, 495, 294, "网络设置");//建立窗口
	pDialog->Center();//窗口对中

	//Register Callback Function for Window
	//pDialog->SetTimeFc(NULL);//注册定时器回调函数
	pDialog->SetDrawFc(NULL);//注册画图回调函数
	pDialog->SetHelpFc(NULL);//注册帮助回调函数
	pDialog->SetKeyboardFc(NULL);//注册虚拟键盘回调函数

	//Create Close's Button Control
	new CCloseButton(pDialog);//分配和建立关闭按钮

	//Create a Label Control
	CLabel* pLabel1 = new CLabel(pDialog);
	pLabel1->CreateObject(141, 38, 61, 12, "本机主机名");
	pLabel1->SetID(LABELBASE + 1 - 1);

	//Create a Label Control
	CLabel* pLabel2 = new CLabel(pDialog);
	pLabel2->CreateObject(141, 88, 160, 21, "本机IP地址");
	pLabel2->SetID(LABELBASE + 2 - 1);

	//Create a Label Control
	CLabel* pLabel3 = new CLabel(pDialog);
	pLabel3->CreateObject(141, 138, 160, 21, "子网掩码");
	pLabel3->SetID(LABELBASE + 3 - 1);

	//Create a Label Control
	CLabel* pLabel4 = new CLabel(pDialog);
	pLabel4->CreateObject(141, 186, 160, 21, "默认网关");
	pLabel4->SetID(LABELBASE + 4 - 1);

	//Create a Label Control
	CLabel* pLabel5 = new CLabel(pDialog);
	pLabel5->CreateObject(141, 232, 160, 21, "NIC地址");
	pLabel5->SetID(LABELBASE + 5 - 1);

	//Create a Label Control
	CLabel* pLabel6 = new CLabel(pDialog);
	pLabel6->CreateObject(313, 38, 61, 12, "对方主机名");
	pLabel6->SetID(LABELBASE + 6 - 1);

	//Create a Label Control
	CLabel* pLabel7 = new CLabel(pDialog);
	pLabel7->CreateObject(313, 88, 61, 12, "对方IP地址");
	pLabel7->SetID(LABELBASE + 7 - 1);

	//Create a Button Control
	CButton* pButton1 = new CButton(pDialog);
	pButton1->CreateObject(325, 249, 133, 25, "退出(\x3\C\x3)");
	pButton1->SetShortcutKey(VK_ALT_C);
	pButton1->SetFc(ClickCancelButton);
	pButton1->SetID(BUTTONBASE + 1 - 1);

	//Create Edit Control
	CEdit* pEdit1 = new CEdit(pDialog);
	pEdit1->CreateObject(141, 61, 160, 21, NULL);
	pEdit1->SetID(EDITBASE + 1 - 1);

	//Create Edit Control
	CEdit* pEdit2 = new CEdit(pDialog);
	pEdit2->CreateObject(141, 112, 160, 21, NULL);
	pEdit2->SetID(EDITBASE + 2 - 1);

	//Create Edit Control
	CEdit* pEdit3 = new CEdit(pDialog);
	pEdit3->CreateObject(141, 160, 160, 21, NULL);
	pEdit3->SetID(EDITBASE + 3 - 1);

	//Create Edit Control
	CEdit* pEdit4 = new CEdit(pDialog);
	pEdit4->CreateObject(141, 208, 160, 21, NULL);
	pEdit4->SetID(EDITBASE + 4 - 1);

	//Create Edit Control
	CEdit* pEdit5 = new CEdit(pDialog);
	pEdit5->CreateObject(141, 257, 160, 21, NULL);
	pEdit5->SetID(EDITBASE + 5 - 1);

	//Create Edit Control
	CEdit* pEdit6 = new CEdit(pDialog);
	pEdit6->CreateObject(313, 61, 160, 21, NULL);
	pEdit6->SetID(EDITBASE + 6 - 1);

	//Create Edit Control
	CEdit* pEdit7 = new CEdit(pDialog);
	pEdit7->CreateObject(313, 112, 160, 21, NULL);
	pEdit7->SetID(EDITBASE + 7 - 1);

	//Create Check Control
	CRadio* pCheck1 = new CRadio(pDialog);
	pCheck1->CreateObject(318, 144, 129, 24, "客户机/服务器");
	pCheck1->SetBox(TRUE);
	pCheck1->SetID(CHECKBASE + 1 - 1);

	//Create a Button Control
	CButton* pButton2 = new CButton(pDialog);
	pButton2->CreateObject(325, 205, 133, 25, "存盘退出(\x3\E\x3)");
	pButton2->SetShortcutKey(VK_ALT_E);
	pButton2->SetFc(ClickEnterButton);
	pButton2->SetID(BUTTONBASE + 2 - 1);

	//Create Group Control
	CStatic* pGroup1 = new CStatic(pDialog);
	pGroup1->CreateObject(130, 28, 354, 256, "");
	pGroup1->SetID(GROUPBASE + 1 - 1);

	//Create a Bitmap Control
	CLabel* pLabel8 = new CLabel(pDialog);
	pLabel8->CreateObject(3, 22, 123, 263, NULL);
	pLabel8->SetBitmapFlags(TRUE);
	pLabel8->SetBackColorDisplay(TRUE);
	pLabel8->SetBitmapFile("Bmp\\DESKTOP.BMP");
	pLabel8->SetID(LABELBASE + 8 - 1);


    pEdit1->SetBuffer(AfxGetHostName());
    pEdit2->SetBuffer(::inet_ntoa(*((in_addr *)&mAfxIpSelfAddr)));
    pEdit3->SetBuffer(::inet_ntoa(*((in_addr *)&mAfxIpMaskAddr)));
    pEdit4->SetBuffer(::inet_ntoa(*((in_addr *)&mAfxIpGatewayAddr)));

    sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",
    	mAfxNICAddr[0], mAfxNICAddr[1], mAfxNICAddr[2],
    	mAfxNICAddr[3], mAfxNICAddr[4], mAfxNICAddr[5]);
    pEdit5->SetBuffer(buf);
    pEdit6->SetBuffer(AfxGetPeerName());
    pEdit7->SetBuffer(::inet_ntoa(*((in_addr *)&mAfxIpPeerAddr)));
    pCheck1->SetRadio(bAfxNetcard);

	//Show Window
	pDialog->ShowWindow();//显示窗口

	//go into Message Loop
	if (pDialog->DoModal() == IDOK)
	{
	}

	//Destroy Window 
	delete pDialog;//删除对话框


	return;

}

⌨️ 快捷键说明

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