⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 set32mkalllight.cpp

📁 解决显示屏亮度调节程序
💻 CPP
字号:
// Set32MKAllLight.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "Set32MKAllLight.h"
#include "Set32MKAllLightDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern int m_show_flag;
extern int m_width,m_height;
extern char INI_PATHFILENAME[256];
/////////////////////////////////////////////////////////////////////////////
// CSet32MKAllLightApp

BEGIN_MESSAGE_MAP(CSet32MKAllLightApp, CWinApp)
	//{{AFX_MSG_MAP(CSet32MKAllLightApp)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CSet32MKAllLightApp construction

CSet32MKAllLightApp::CSet32MKAllLightApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CSet32MKAllLightApp object

CSet32MKAllLightApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CSet32MKAllLightApp initialization

BOOL CSet32MKAllLightApp::InitInstance()
{
	//Set32MKAllLight (Ver1.00) for win9x,2000,xp
	static char MyAppTitle[]="Set32MKAllLight (Ver1.00) for win9x,2000,xp";
	 if(FindWindow(NULL,MyAppTitle)!=NULL) 
	 { 
		 return FALSE;//不运行第二个实例. 
	 } 
	AfxEnableControlContainer();

	// 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

	CSet32MKAllLightDlg 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;
}

BOOL CSet32MKAllLightApp::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	char tmp_str[256];
	int line_no=0;;
	int col_no=0;
	int tmp_flag=0;
	int k=0;
	switch(pMsg->message)
	{
	
	case WM_KEYDOWN:
		{
			switch (pMsg->wParam)
			{
				//case VK_ESCAPE:
				//	  break;
				case VK_RETURN:
					  m_show_flag=0;
					  sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  //DrawMK();
					  AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					  
					  return TRUE;
				case VK_SPACE:
					 m_show_flag++;
					 if(m_show_flag>3*m_width*m_height) 
					 {
						 m_show_flag=1;
					 }
					  sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  
					 //DrawMK();
					 AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					 break;//return TRUE;
				case VK_DELETE:
                     
					 if(m_show_flag>1) 
					 {
						 m_show_flag--;
					 }
					  sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  
					 //DrawMK();
					 AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					 break;
					 break;
				/*case VK_LEFT:///同一颜色页面向后退一
					  
					  k=m_show_flag/(m_width*m_height);
					
					  if(m_show_flag-1>k*(m_width*m_height))
					  {					  
					     m_show_flag--;
					  }					  
					 				  
					   sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  
					 //DrawMK();
					 AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					 break;
				case VK_RIGHT://同一颜色页面向前进一
					  k=m_show_flag/(m_width*m_height);

					if(m_show_flag+1<(k+1)*(m_width*m_height))
					 {					  
					     m_show_flag++;					  					    		  
					   
					}
					sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  
					 //DrawMK();
					  AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					  
					 break;
					 
				case VK_UP://同一列向上移一行直到第一行
					  k=m_show_flag/(m_width*m_height);
					  if(m_show_flag-m_width>k*m_width*m_height)
					  {					  
					     m_show_flag-=m_width;
					  }					  
					 				  
					   sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  
					 //DrawMK();
					 AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					 break;
				case VK_DOWN://同一列向处移一行直到最后一行
					k=m_show_flag/(m_width*m_height);
					 if(m_show_flag+m_width<(k+1)*m_width*m_height)
					  {					  
					     m_show_flag+=m_width;
					  }					  
					 				  
					   sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  
					 //DrawMK();
					 AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					 break;
					*/
				case VK_PRIOR://同一行的开头
					  
					 if(m_show_flag-m_width*m_height>0)
					 {
						 m_show_flag-=m_height*m_width;
					  
					     
					 }
					 else
					 {
						 m_show_flag+=m_height*m_width;

					 }

					 //DrawMK();
					  sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  				 
					  AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					  
					 break;
				case VK_NEXT://同一行的尾部
				   	  if(m_show_flag+m_width*m_height<3*m_width*m_height)
					 {
						 m_show_flag+=m_height*m_width;
					  
					     
					 }
					 else
					 {
						 m_show_flag-=m_height*m_width;

					 }

					 //DrawMK();
					  sprintf(tmp_str,"%d",m_show_flag);
					  WritePrivateProfileString("SCREEN","SHOW_FLAG",tmp_str,INI_PATHFILENAME);
					  				 
					  AfxGetApp()->GetMainWnd()->SendMessage(WM_MY_KEY,0,0);
					  break;
				
				default:
					break;
			}
		}
		 break;
	default:
		   break;
	}	
	return CWinApp::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -