SmsCenter/SmsCenter.cpp

139 lines
3.5 KiB
C++
Raw Normal View History

2025-01-03 16:47:25 +08:00
// SmsCenter.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "SmsCenter.h"
#include "SmsCenterDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSmsCenterApp
#include <Psapi.h>
#include "..\public\MiniDmp\MiniDmp.h"
BEGIN_MESSAGE_MAP(CSmsCenterApp, CWinApp)
//{{AFX_MSG_MAP(CSmsCenterApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSmsCenterApp construction
CSmsCenterApp::CSmsCenterApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CSmsCenterApp object
CSmsCenterApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CSmsCenterApp initialization
//#include "..\..\shou-e\RN_Eri\blowfish_Eri.h"
BOOL CSmsCenterApp::InitInstance()
{
/*
int a = sizeof(long);
int b = sizeof(float);
int c = sizeof(double);
int d=sizeof(UCHAR);
int e=sizeof(int);
*/
#if _MSC_VER>=1300
#ifdef _M_IX86
#ifndef _DEBUG
GPTSetSetUnhandledExceptionFilter(); //<2F><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#endif
#endif
#endif
AfxEnableControlContainer();
//CoInitialize(NULL);
CoInitializeEx( NULL , COINIT_MULTITHREADED );
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
/*
if ( FindProcess(_T("SmsCenter.exe"))>1 )
{
int iRet = MessageBox(NULL,_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD>򣬿<EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD>ڲ<EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\r\n<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 );
if ( iRet != IDYES )
return false;
}
*/
CSmsCenterDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
int CSmsCenterApp::ExitInstance()
{
CoUninitialize();
return CWinApp::ExitInstance();
}
long CSmsCenterApp::FindProcess(const TCHAR *pName)
{
long lCount=0;
BOOL bReBoot = false;
DWORD aProcesses[1024], cbNeeded, cProcesses;
unsigned int i;
//ö<><C3B6>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>ID<49>б<EFBFBD>
if ( EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
{
// Calculate how many process identifiers were returned.
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cProcesses = cbNeeded / sizeof(DWORD);
// <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><CCB5><EFBFBD><EFBFBD>ƺ<EFBFBD>ID
TCHAR szProcessName[MAX_PATH]={0};
for ( i = 0; i < cProcesses; i++ )
{
memset( szProcessName ,0, sizeof(szProcessName) );
CSmsCenterDlg::GetProcessNameAndID( aProcesses[i],szProcessName);
//if ( !strcmp( szProcessName , pName ) ) //<2F><><EFBFBD><EFBFBD>Dh2000<30>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>
if ( !_tcsncmp( szProcessName , pName , _tcslen(pName) ) ) //<2F><><EFBFBD><EFBFBD>Dh2000<30>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>
{
lCount ++;
}
}
}
return lCount;
}