资源预览内容
第1页 / 共4页
第2页 / 共4页
第3页 / 共4页
第4页 / 共4页
亲,该文档总共4页全部预览完了,如果喜欢就下载吧!
资源描述
C+获取IP地址和主机名一个简单的c+程序,用于获取主机名和IP地址。源码下载地址:http:/www.vdisk.cn/down/index/10540450 该程序通过自己的测试,能在visual c+ 6.0中完美运行。GetIP.cpp#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CGetIPAppBEGIN_MESSAGE_MAP(CGetIPApp, CWinApp)/AFX_MSG_MAP(CGetIPApp)/ NOTE - the ClassWizard will add and remove mapping macros here./ DO NOT EDIT what you see in these blocks of generated code!/AFX_MSGON_COMMAND(ID_HELP, CWinApp:OnHelp)END_MESSAGE_MAP()/ CGetIPApp constructionCGetIPApp:CGetIPApp()/ TODO: add construction code here,/ Place all significant initialization in InitInstance/ The one and only CGetIPApp objectCGetIPApp theApp;/ CGetIPApp initializationBOOL CGetIPApp:InitInstance()if (!AfxSocketInit()AfxMessageBox(IDP_SOCKETS_INIT_FAILED);return FALSE;AfxEnableControlContainer();/ Standard initialization/ If you are not using these features and wish to reduce the size/ of your final executable, you should remove from the following/ the specific initialization routines you do not need.#ifdef _AFXDLLEnable3dControls();/ Call this when using MFC in a shared DLL#elseEnable3dControlsStatic();/ Call this when linking to MFC statically#endif CGetIPDlg dlg;m_pMainWnd = &dlg;int nResponse = dlg.DoModal();if (nResponse = IDOK)/ TODO: Place code here to handle when the dialog is/ dismissed with OKelse if (nResponse = IDCANCEL)/ TODO: Place code here to handle when the dialog is/ dismissed with Cancel WSADATA wsaData;WSAStartup(MAKEWORD(1,1),&wsaData);/ Since the dialog has been closed, return FALSE so that we exit the/ application, rather than start the applications message pump.return FALSE;int CGetIPApp:ExitInstance() WSACleanup();return CWinApp:ExitInstance();GetIP.h/ GetIP.h : main header file for the GETIP application/#if !defined(AFX_GETIP_H_4F5A3E39_11E1_4654_A5DA_75F3810AD470_INCLUDED_)#define AFX_GETIP_H_4F5A3E39_11E1_4654_A5DA_75F3810AD470_INCLUDED_#if _MSC_VER 1000#pragma once#endif / _MSC_VER 1000#ifndef _AFXWIN_H_#error include stdafx.h before including this file for PCH#endif#include resource.h/ main symbols/ CGetIPApp:/ See GetIP.cpp for the implementation of this class/class CGetIPApp : public CWinApppublic:CGetIPApp();/ Overrides/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CGetIPApp)public:virtual BOOL InitInstance();virtual int ExitInstance();/AFX_VIRTUAL/ Implementation/AFX_MSG(CGetIPApp)/ NOTE - the ClassWizard will add and remove member functions here./ DO NOT EDIT what you see in these blocks of generated code !/AFX_MSGDECLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Microsoft Visual C+ will insert additional declarations immediately before the previous line.#endif / !defined(AFX_GETIP_H_4F5A3E39_11E1_4654_A5DA_75F3810AD470_INCLUDED_)运行界面:
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号