📄 publicfun.cpp
字号:
#include "StdAfx.h"
#include "PublicFun.h"
#include "resource.h"
enum RadioSlectType
{
Metting = 1,
Silence = 2,
Standard = 3,
};
CPublicFun * CPublicFun::m_CPublicFun = NULL;
CPublicFun::CPublicFun()
{
}
CPublicFun::~CPublicFun(void)
{
}
CPublicFun * CPublicFun::GetInstance()
{
if(NULL == m_CPublicFun)
{
m_CPublicFun = new CPublicFun;
atexit(CPublicFun::DeleteInstance);
if(NULL == m_CPublicFun)
{
return NULL;
}
}
return m_CPublicFun;
}
void CPublicFun::DeleteInstance()
{
if(NULL != m_CPublicFun)
{
delete m_CPublicFun;
m_CPublicFun = NULL;
}
}
/*
*Function: The function create menubar in a window
*/
BOOL CPublicFun::CreateMenuBar(HWND hwndParent,UINT menuID,int iEnable)
{
// Create bar and check for errors.
HWND g_hwndMb;
BOOL bSuccess = FALSE;
SHMENUBARINFO mbi;
SecureZeroMemory(&mbi, sizeof(SHMENUBARINFO));// Zero structure
mbi.cbSize = sizeof(SHMENUBARINFO); // Size field
mbi.hwndParent = hwndParent; // Parent window
mbi.nToolBarId = menuID; // ID of tool bar resource
mbi.hInstRes = _Module.GetModuleInstance(); // Inst handle of app
bSuccess = SHCreateMenuBar(&mbi);
g_hwndMb = mbi.hwndMB;
switch(iEnable)
{
case 0:
SHEnableSoftkey(g_hwndMb, 0, TRUE, FALSE);
break;
case 1:
SHEnableSoftkey(g_hwndMb, 1, TRUE, FALSE);
break;
case 2:
SHEnableSoftkey(g_hwndMb, 0, TRUE, FALSE);
SHEnableSoftkey(g_hwndMb, 1, TRUE, FALSE);
break;
default:
break;
}
return bSuccess;
}
/*
*Function: The function set window title which is got from resource.
*/
BOOL CPublicFun::SetWindowTitle(HWND hWnd,UINT nTitleID)
{
BOOL bSuccess = FALSE;
TCHAR szTitle[50] = { 0 };
LoadString(_Module.GetModuleInstance(), nTitleID, szTitle, 50);
bSuccess = ::SetWindowText(hWnd,szTitle);
return bSuccess;
}
/*
*Function: The function set Dialog Size which is got full Screen.
*/
BOOL CPublicFun::fullScreen(HWND dlgWnd)
{
SHINITDLGINFO shidi;
memset (&shidi, 0, sizeof(shidi));
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;
shidi.hDlg = dlgWnd;
if(!SHInitDialog(&shidi))
{
return FALSE;
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -