📄 supercharger.cpp
字号:
// SuperCharger.cpp : Defines the class behaviors for the application.
//
/////////////////////////////////////////////////////////////////////////////
//
/**************************************************************
** __ __
** __/_/__________________________________________\_\__
** __|_ |__
** (___O) William SerGio & Co., Inc. (O___)
**(_____O) www.software-rus.com (O_____)
**(_____O) Author: Bill SerGio, Infomercial King(tm) (O_____)
** (__O) (O__)
** |___________________________________________________|
**
****************************************************************/
/*
* Portions of this code were contributed by other authors and modified
* in varying degress by Bill SerGio. The original copyright notices of
* any other authors are left intact wherever they appeared in the
* original code by that author. All other portions of this code are:
* (C) Copyright 1997-1999 William SerGio & Co.,Inc, All Rights Reserved Worldwide.
* 20547 Old Cutler Road, PMB #222, Miami, FL 33189
* www.software-rus.com tvmogul1@yahoo.com (305)233-9370
* NO PART of this code under copyright of William SerGio & Co., Inc.
* may be used for any comercial purposes whatsoever.
* Any site to which this source code is posted MUST AGREE to the copyright terms stated
* here and that the terms stated here supercede any and all terms stated on any
* website to which this code may be posted or offerred. If you do not agree to
* this, then you must remove this source code from your website immediately.
*
* Patents Pending regarding design and user interface concepts embodied herein.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted under this non-exclusive license for NON-COMMERCIAL USE ONLY
* provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Licensee does not utilize the software in a manner which is disparaging
* to the Author and/or any products or companies of the Author.
* 4. This code/software may NOT be used for any commercial purpose whatsoever
* or by any government, federal agency, or, any employee or agent of any
* government or federal agency. This software is not designed or intended for
* use in on-line control of aircraft, air traffic, aircraft navigation or
* aircraft communications; or in design, construction, operation or maintenance
* of any nuclear facility. Licensee represents and warrants that it will not use
* or redistribute the Software for such purposes.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR FOR EDUCATIONAL PURPOSES ONLY,
* 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS,
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION),
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* NOTICE:
* Contact author regarding commercial licensing of this code.
* NOTE: William SerGio & Co., Inc., owns all rights, including trademarks
* and copyrights to the artwork in this article and demo and to the names
* Windows & Internet SuperCharger(tm), SuperCharger(tm), and SpeedD(tm).
* You may NOT use or distribute these copyrights and trademarks in any way
* without the expressed written consent of William SerGio & Co., Inc. Further,
* author does NOT warranty this code or software is fit for any purpose or use
* whatsoever, and does NOT make any claims of any kind for this code or software.
*
*/
#include "stdafx.h"
#include "SuperCharger.h"
#include "SuperChargerDlg.h"
#include "global.h"
#define __g_Global__
CGlobal g_Global;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern "C" __declspec(dllimport) long CallRegDlg(int itype,
int idemo,
int iprog,
char* serial,
char* rauth);
CSuperChargerDlg *g_pDlg = NULL;
/////////////////////////////////////////////////////////////////////////////
// CSuperChargerApp
BEGIN_MESSAGE_MAP(CSuperChargerApp, CWinApp)
//{{AFX_MSG_MAP(CSuperChargerApp)
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSuperChargerApp construction
CSuperChargerApp::CSuperChargerApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CSuperChargerApp object
CSuperChargerApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CSuperChargerApp initialization
BOOL CSuperChargerApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
/**
* BILL'S NOTE: You can use mutex or file mapping
* But better is using Shared Memory & Mutex
*/
// Mutex technique only
HANDLE hMutexOneInstance = ::CreateMutex( NULL, FALSE, "SUPERCHARGER");
// Changes for alternative solutions is UID in above call
// which will be replaced by a call on createExclusionName
BOOL AlreadyRunning;
AlreadyRunning = (GetLastError() == ERROR_ALREADY_EXISTS ||
GetLastError() == ERROR_ACCESS_DENIED);
// The call fails with ERROR_ACCESS_DENIED if the Mutex was
// created in a different users session because of passing
// NULL for the SECURITY_ATTRIBUTES on Mutex creation);
if ( AlreadyRunning ) {
if(hMutexOneInstance) { CloseHandle(hMutexOneInstance); }
return 0;
}
//////////////////////////
// File mapping technique
//////////////////////////
//CString str;
//str.FormatMessage(IDS_APPLICATIONNAME);
//m_hFileMapping = CreateFileMapping( (HANDLE) 0xFFFFFFFF,
// NULL,
// PAGE_READONLY,
// 0,
// 32,
// str );
//if (m_hFileMapping){
// if (GetLastError() == ERROR_ALREADY_EXISTS){
// MessageBox(NULL, "Application is already running.", str, MB_OK);
// return TRUE;
// }
//}
//else {
// MessageBox(NULL, "Error creating file mapping", str, MB_OK);
// return TRUE;
//}
// Create our fucking modeless dialog
g_pDlg = new CSuperChargerDlg;
if (g_pDlg == NULL)
{
::MessageBox(NULL, "Unable to create main window.", "SuperCharger", MB_ICONHAND);
return FALSE;
}
if (!g_pDlg->Create(IDD_SUPERCHARGER_DLG))
{
::MessageBox(NULL, "CSuperChargerDlg::Create() failed.", "SuperCharger", MB_ICONHAND);
return FALSE;
}
// Set dialog as our main window.
m_pMainWnd = (CWnd*) g_pDlg;
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -