tspapp.cpp

来自「遗传算法的一个例子:旅行商问题。C++源代码」· C++ 代码 · 共 62 行

CPP
62
字号
#include "stdafx.h"
#include "main.h"

#pragma comment (lib, "comctl32") 

//Don't remove the Object map macros. They make the ATL wizard work

BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()

namespace
{	
	struct _coinit
	{
		_coinit()
		{
			::CoInitialize(NULL);
		}
		~_coinit()
		{
			::CoUninitialize();
		}
	} __coinit;
}
CComModule _Module;

/////////////////////////////////////////////
// mem_pool TSPBase::g_mem_pool;
mem_pool* TSPBase::g_mem_pool = 0;
/////////////////////////////////////////////

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) 
{
	_Module.Init(ObjectMap, hInstance);

	{		
		srand(time(0));

		INITCOMMONCONTROLSEX icc = {sizeof INITCOMMONCONTROLSEX, ICC_UPDOWN_CLASS|ICC_BAR_CLASSES};
		InitCommonControlsEx(&icc);

		_Main main;
		main.Create(0, 0);
		main.ShowWindow(SW_SHOW);
		main.UpdateWindow();

		MSG msg;
		
		while (GetMessage(&msg,  0, 0, 0))
		{
			if (!main.DispatchDialogMessage(&msg)) 
			{
				DispatchMessage(&msg);
				TranslateMessage(&msg);
			}
		}
	}

	_Module.Term();
	return 0;
}

⌨️ 快捷键说明

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