You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.5 KiB
C++

#include "StdAfx.h"
#include "ApplicationPriority.h"
#include "PropertieMgr.h"
#include "Propertie.h"
#include "LogMgr.h"
#include "AuthorityMgr.h"
CAppPriorityMgr *gAppPriorityMgr = new CAppPriorityMgr;
CAppPriorityMgr::CAppPriorityMgr(void)
{
m_bGetHighestPriority = false;//<2F>Ƿ<EFBFBD><C7B7>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
}
CAppPriorityMgr::~CAppPriorityMgr(void)
{
}
CMFCPropertyGridProperty *CAppPriorityMgr::CreatGridProperty()
{
CString PropertyName;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CString Description;//<2F><><EFBFBD><EFBFBD>
CString Path = _T("AppPriority");//<2F>洢·<E6B4A2><C2B7>
CString Name;
CString GroupName;
CString ModuleName;
//-------------------------------------------------------------------------------//
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>");
GroupName = PropertyName;
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
//-------------------------------------------------------------------------------//
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
Name = _T("m_bGetHighestPriority");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bGetHighestPriority);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>");
Description = _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>");
pPropertie->SetGroupName(GroupName);
pPropertie->SetShowName(PropertyName);
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bGetHighestPriority, Description);
pGroup->AddSubItem(p);
gDevicePropertieMgr.Insert(p, pPropertie);
}
//-------------------------------------------------------------------------------//
return pGroup;
}
void CAppPriorityMgr::OnAppInitialize()
{
if(m_bGetHighestPriority)
{
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
GetHighestPriority();
}
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
void CAppPriorityMgr::GetHighestPriority()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
if(SetPriorityClass( GetCurrentProcess(), REALTIME_PRIORITY_CLASS ))
{
gLogMgr->WriteDebugLog("Func---->CAppPriorityMgr : GetHighestPriority : OK");
}
else
{
gLogMgr->WriteDebugLog("Err---->CAppPriorityMgr : GetHighestPriority : Err");
}
}