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

📄 examplepw.cpp

📁 Many programs today suffer from the fact that their users have to connect using IP addresses. This i
💻 CPP
字号:
#include "stdafx.h"
#include "Defines.h"
#include "ExamplePW.h"
#include "ExamplePWDlg.h"
#include "AwareNet.h"

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

BEGIN_MESSAGE_MAP(CExamplePWApp, CWinApp)
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

CExamplePWApp::CExamplePWApp()
{
}

CExamplePWApp theApp;

BOOL CExamplePWApp::InitInstance()
{
	HWND PrevWindow;

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	/* Make sure ExamplePW is not already running, and if it is,
	   bring it to the front and quit this instantiation */
	PrevWindow = FindWindow(NULL, "ExamplePW");
	if(GlobalFindAtom(INTERNAL_ATOM) != 0 && PrevWindow)
	{
		SetForegroundWindow(PrevWindow);
		return FALSE;
	}
	
	/* Add the global atom to make sure this is the only copy
	   open at once */
	GlobalAddAtom(INTERNAL_ATOM);

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	
	/*********************** AWARENET ***********************/
	/* Create an instance of the CAwareNet class.  From this
	   instantiation we'll get all our AwareNet 
	   functionality                                        */

	CAwareNet AwareNet;
	
	/* Start the main window */
	CExamplePWDlg *dlg = new CExamplePWDlg(NULL, &AwareNet);

	m_pMainWnd = dlg;
	int nResponse = dlg->DoModal();
	delete dlg;

	/*********************** AWARENET ***********************/
	/* We're done using AwareNet.  Deallocate it.  You must
	   do this when your program ends.                      */

	AwareNet.Deallocate(EXAMPLEPW_SERVICE);

	/* Clear out the global atom so we can start the program
	   again if we want to */
	while(GlobalFindAtom(INTERNAL_ATOM) != 0)
		GlobalDeleteAtom(GlobalFindAtom(INTERNAL_ATOM));

	return FALSE;
}

⌨️ 快捷键说明

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