Having searched extensively, I'm sorry to report that I cannot find any code examples of how to change the mouse tracking icon during runtime. I wish to emulate the Microsoft Paint app behavior with respect, for example, to click on a toolbar button such as the 'Fill With Color' bucket and have the mouse pointer icon change to a little bucket. I wish to do this in an MFC SDI app. Any help greatly appreciated. FWIW, I have tried various Microsoft web help code but nothing seems to work for me as I'm probably missing something.
Here's a bit of code that does nothing that I can tell, although it compiles and runs. (m_hIcon2 is a member HANDLE, IDI_FLOODFILL is an existing icon in the app resources). I have come across numerous other examples that do not work and/or will not compile using VS 2010 Win7(64).
Any help greatly appreciated.
Here's a bit of code that does nothing that I can tell, although it compiles and runs. (m_hIcon2 is a member HANDLE, IDI_FLOODFILL is an existing icon in the app resources). I have come across numerous other examples that do not work and/or will not compile using VS 2010 Win7(64).
Code:
void CMainFrame::SetNewIcon()
{
m_hIcon2 = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_FLOODFILL));
SetIcon(m_hIcon2, FALSE);
}// SetNewIcon()
void CMainFrame::OnFloodFill()
{
TRACE0("Clicked on Flood Fill toolbar button\n");
//m_wndToolBar2.GetToolBarCtrl().
//UINT nStyle = 0;
//m_wndToolBar2.SetButtonStyle(13, nStyle);
m_bFloodFill = !m_bFloodFill;
if(m_bFloodFill) { TRACE0("Need to change the icon to IDI_FLOODFILL here.\n"); SetNewIcon(); }
if(!m_bFloodFill) { TRACE0("Need to change the icon from IDI_FLOODFILL to standard here.\n"); }
}
void CMainFrame::OnUpdateFloodFill(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_bFloodFill);
}