Click here to Skip to main content
15,892,643 members
Articles / Desktop Programming / WTL

A little tool to show some system informations

Rate me:
Please Sign up or sign in to vote.
4.59/5 (15 votes)
12 May 2007CPOL1 min read 40.1K   3K   42  
This small tool shows some real-time system information, such as network speed, CPU utilization, time period and so on on the screen .
// SysInfo.cpp : main source file for SysInfo.exe
//

#include "stdafx.h"

#include "resource.h"

#include "aboutdlg.h"
#include "MyFontDlg.h"
#include "OptionDlg.h"
#include "HistoryDlg.h"
#include "trayiconimpl.h"
#include "AutoSnapImpl.h"
#include "AutoHideImpl.h"
#include "HistoryPopupWnd.h"
#include "MainFrm.h"

CAppModule _Module;

int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CStrSegRunTime::InitStaticData();

	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CMainFrame wndMain;

	RECT rrr;
	rrr.left = 0;
	rrr.top = 0;
	rrr.right = 0;
	rrr.bottom = 0;
	_U_RECT rect(rrr);

	if(wndMain.Create(NULL, rect) == NULL)
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	wndMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to 
// make the EXE free threaded. This means that calls come in on a random RPC thread.
//	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
	::DefWindowProc(NULL, 0, 0, 0L);

	AtlInitCommonControls(ICC_BAR_CLASSES);	// add flags to support other controls

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	int nRet = Run(lpstrCmdLine, nCmdShow);

	_Module.Term();
	::CoUninitialize();

	return nRet;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions