139 lines
3.5 KiB
C++
139 lines
3.5 KiB
C++
// 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(); //ÆôÓôíÎóÀ¹½Ø
|
||
#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("ÒÑÆô¶¯Á˶ÌÐÅ·þÎñÆ÷¼à¿Ø³ÌÐò£¬¿ÉÄÜ´¦ÓÚ²»Í¬µÄÓû§£¬Çë¼ì²é!\r\nÊÇ·ñ¼ÌÐøÆô¶¯£¿") , _T("ÌáÎÊ") , 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;
|
||
//ö¾Ùϵͳ½ø³ÌIDÁбí
|
||
if ( EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
|
||
{
|
||
// Calculate how many process identifiers were returned.
|
||
//¼ÆËã½ø³ÌÊýÁ¿
|
||
cProcesses = cbNeeded / sizeof(DWORD);
|
||
// Êä³öÿ¸ö½ø³ÌµÄÃû³ÆºÍ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 ) ) //²éÕÒDh2000µÄ½ø³ÌÃû
|
||
if ( !_tcsncmp( szProcessName , pName , _tcslen(pName) ) ) //²éÕÒDh2000µÄ½ø³ÌÃû
|
||
{
|
||
lCount ++;
|
||
}
|
||
}
|
||
}
|
||
return lCount;
|
||
}
|