MFC对话框中定义光标的热区


这是一个工程实例,将实现为对话框中的控件定义光标热区,即当鼠标光标位于某个控件上时,改变鼠标的显示光标,并给出该控件的描述性信息。
资源截图
代码片段和文件信息

// CursorHotDemo.cpp : Defines the class behaviors for the application.
//

#include “stdafx.h“
#include “CursorHotDemo.h“
#include “CursorHotDemoDlg.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CCursorHotDemoApp

BEGIN_MESSAGE_MAP(CCursorHotDemoApp CWinApp)
ON_COMMAND(ID_HELP &CWinApp::onhelp)
END_MESSAGE_MAP()


// CCursorHotDemoApp construction

CCursorHotDemoApp::CCursorHotDemoApp()
{
// support Restart Manager
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;

// TODO: add construction code here
// Place all significant initialization in InitInstance
}


// The one and only CCursorHotDemoApp object

CCursorHotDemoApp theApp;


// CCursorHotDemoApp initialization

BOOL CCursorHotDemoApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles.  Otherwise any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);

CWinApp::InitInstance();


AfxEnableControlContainer();

// Create the shell manager in case the dialog contains
// any shell tree view or shell list view controls.
CShellManager *pShellManager = new CShellManager;

// 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
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T(“Local AppWizard-Generated Applications“));

CCursorHotDemoDlg dlg;
m_pMainWnd = &dlg;
INT_PTR 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
}

// Delete the shell manager created above.
if (pShellManager != NULL)
{
delete pShellManager;
}

// Since the dialog has been closed return FALSE so that we exit the
//  application rather than start the application‘s message pump.
return FALSE;
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-10-03 10:40  CursorHotDemo
     目录           0  2012-10-03 10:32  CursorHotDemoCursorHotDemo
     文件      110700  2012-10-03 10:32  CursorHotDemoCursorHotDemoCursorHotDemo.aps
     文件        2560  2012-10-02 22:07  CursorHotDemoCursorHotDemoCursorHotDemo.cpp
     文件         547  2012-10-02 21:29  CursorHotDemoCursorHotDemoCursorHotDemo.h
     文件       11824  2012-10-03 10:32  CursorHotDemoCursorHotDemoCursorHotDemo.rc
     文件        6009  2012-10-03 10:29  CursorHotDemoCursorHotDemoCursorHotDemo.vcxproj
     文件        2155  2012-10-02 22:14  CursorHotDemoCursorHotDemoCursorHotDemo.vcxproj.filters
     文件         143  2012-10-02 21:29  CursorHotDemoCursorHotDemoCursorHotDemo.vcxproj.user
     文件        4693  2012-10-03 10:28  CursorHotDemoCursorHotDemoCursorHotDemoDlg.cpp
     文件         723  2012-10-03 10:25  CursorHotDemoCursorHotDemoCursorHotDemoDlg.h
     目录           0  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebug
     文件       51580  2012-10-03 10:29  CursorHotDemoCursorHotDemoDebugCL.read.1.tlog
     文件        2482  2012-10-03 10:29  CursorHotDemoCursorHotDemoDebugCL.write.1.tlog
     文件         667  2012-10-03 10:29  CursorHotDemoCursorHotDemoDebugCursorHotDemo.exe.embed.manifest
     文件         732  2012-10-03 10:29  CursorHotDemoCursorHotDemoDebugCursorHotDemo.exe.embed.manifest.res
     文件         381  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebugCursorHotDemo.exe.intermediate.manifest
     文件          96  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebugCursorHotDemo.lastbuildstate
     文件        2288  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebugCursorHotDemo.log
     文件       29851  2012-10-03 10:29  CursorHotDemoCursorHotDemoDebugCursorHotDemo.obj
     文件    33619968  2012-10-03 10:29  CursorHotDemoCursorHotDemoDebugCursorHotDemo.pch
     文件       74200  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebugCursorHotDemo.res
     文件       43583  2012-10-03 10:29  CursorHotDemoCursorHotDemoDebugCursorHotDemoDlg.obj
     文件         216  2012-10-03 10:05  CursorHotDemoCursorHotDemoDebugCursorHotDemo_manifest.rc
     文件        2728  2012-10-03 10:29  CursorHotDemoCursorHotDemoDebugcl.command.1.tlog
     文件           2  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebuglink-cvtres.read.1.tlog
     文件           2  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebuglink-cvtres.write.1.tlog
     文件        2460  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebuglink.command.1.tlog
     文件        5764  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebuglink.read.1.tlog
     文件        1930  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebuglink.write.1.tlog
     文件         728  2012-10-03 10:32  CursorHotDemoCursorHotDemoDebugmt.command.1.tlog
............此处省略26个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)