mirror of
https://github.com/zodiacon/WindowsInternals
synced 2026-08-09 13:18:09 +00:00
124 lines
2.9 KiB
C++
124 lines
2.9 KiB
C++
|
|
// CPUStressEx.cpp : Defines the class behaviors for the application.
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "afxwinappex.h"
|
|
#include "afxdialogex.h"
|
|
#include "CPUStressEx.h"
|
|
#include "MainFrm.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
|
|
// CCPUStressExApp
|
|
|
|
BEGIN_MESSAGE_MAP(CCPUStressExApp, CWinApp)
|
|
ON_COMMAND(ID_APP_ABOUT, &CCPUStressExApp::OnAppAbout)
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
// CCPUStressExApp construction
|
|
|
|
CCPUStressExApp::CCPUStressExApp() {
|
|
// TODO: replace application ID string below with unique ID string; recommended
|
|
// format for string is CompanyName.ProductName.SubProduct.VersionInformation
|
|
SetAppID(_T("CPUStressEx.AppID.NoVersion"));
|
|
|
|
// TODO: add construction code here,
|
|
// Place all significant initialization in InitInstance
|
|
}
|
|
|
|
// The one and only CCPUStressExApp object
|
|
|
|
CCPUStressExApp theApp;
|
|
|
|
|
|
// CCPUStressExApp initialization
|
|
|
|
BOOL CCPUStressExApp::InitInstance() {
|
|
int argc = 0;
|
|
auto argv = ::CommandLineToArgvW(::GetCommandLine(), &argc);
|
|
|
|
::SetThreadPriority(::GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
|
|
|
// InitCommonControlsEx() is required on Windows XP if an application
|
|
// manifest specifies use of ComCtl32.dll version 6 or later to enable
|
|
// visual styles. Otherwise, any window creation will fail.
|
|
INITCOMMONCONTROLSEX InitCtrls;
|
|
InitCtrls.dwSize = sizeof(InitCtrls);
|
|
// Set this to include all the common control classes you want to use
|
|
// in your application.
|
|
InitCtrls.dwICC = ICC_LISTVIEW_CLASSES;
|
|
InitCommonControlsEx(&InitCtrls);
|
|
|
|
CWinApp::InitInstance();
|
|
|
|
// To create the main window, this code creates a new frame window
|
|
// object and then sets it as the application's main window object
|
|
CMainFrame* pFrame = new CMainFrame;
|
|
if (!pFrame)
|
|
return FALSE;
|
|
|
|
m_pMainWnd = pFrame;
|
|
// create and load the frame with its resources
|
|
pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW, NULL, NULL);
|
|
pFrame->SetWindowPos(nullptr, 0, 0, 640, 400, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREPOSITION);
|
|
|
|
// The one and only window has been initialized, so show and update it
|
|
pFrame->ShowWindow(SW_SHOW);
|
|
pFrame->UpdateWindow();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
int CCPUStressExApp::ExitInstance() {
|
|
//TODO: handle additional resources you may have added
|
|
return CWinApp::ExitInstance();
|
|
}
|
|
|
|
// CCPUStressExApp message handlers
|
|
|
|
|
|
// CAboutDlg dialog used for App About
|
|
|
|
class CAboutDlg : public CDialogEx {
|
|
public:
|
|
CAboutDlg();
|
|
|
|
// Dialog Data
|
|
#ifdef AFX_DESIGN_TIME
|
|
enum { IDD = IDD_ABOUTBOX };
|
|
#endif
|
|
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
|
|
// Implementation
|
|
protected:
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX) {
|
|
}
|
|
|
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX) {
|
|
CDialogEx::DoDataExchange(pDX);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
|
|
END_MESSAGE_MAP()
|
|
|
|
// App command to run the dialog
|
|
void CCPUStressExApp::OnAppAbout() {
|
|
CAboutDlg aboutDlg;
|
|
aboutDlg.DoModal();
|
|
}
|
|
|
|
// CCPUStressExApp message handlers
|
|
|
|
|
|
|