Need help quick on a couple of silly simple problems
-
Hi; My first post... silly and simple questions, but i've poured through MS Disaster Network (MSDN) and Wrox "Professional MFC 6.0", and can't find answers to easy questions. I've done these in the past, but it's been so long that i've forgotten how. First, how in the blink do you add a custom app icon (upper left corner icon)? I modified the stock Wizard supplied icon (the building blocks one) and yet, the app doesn't use it! It's in the project and the IDR_MAINFRAME rc is pointing at the correct file but... argh! Secondly, I need to intercept both the minimize button on the right of the title bar and also the minimise menu item on the system menu so that when the user clicks on those, I can minimize to the tray instead of the task bar - client requirement (and i'd like to know how to do it myself!). I already have a menu item for minimize to tray (on the view menu), but need it this way too. TIA! Dave LeBlanc
-
Hi; My first post... silly and simple questions, but i've poured through MS Disaster Network (MSDN) and Wrox "Professional MFC 6.0", and can't find answers to easy questions. I've done these in the past, but it's been so long that i've forgotten how. First, how in the blink do you add a custom app icon (upper left corner icon)? I modified the stock Wizard supplied icon (the building blocks one) and yet, the app doesn't use it! It's in the project and the IDR_MAINFRAME rc is pointing at the correct file but... argh! Secondly, I need to intercept both the minimize button on the right of the title bar and also the minimise menu item on the system menu so that when the user clicks on those, I can minimize to the tray instead of the task bar - client requirement (and i'd like to know how to do it myself!). I already have a menu item for minimize to tray (on the view menu), but need it this way too. TIA! Dave LeBlanc
For custom Icon, in your dialog constructor, add // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDI_MYICON); There may be other ways but this is what the wizard gives me and it works when I am using MFC. Have Fun!
-
Hi; My first post... silly and simple questions, but i've poured through MS Disaster Network (MSDN) and Wrox "Professional MFC 6.0", and can't find answers to easy questions. I've done these in the past, but it's been so long that i've forgotten how. First, how in the blink do you add a custom app icon (upper left corner icon)? I modified the stock Wizard supplied icon (the building blocks one) and yet, the app doesn't use it! It's in the project and the IDR_MAINFRAME rc is pointing at the correct file but... argh! Secondly, I need to intercept both the minimize button on the right of the title bar and also the minimise menu item on the system menu so that when the user clicks on those, I can minimize to the tray instead of the task bar - client requirement (and i'd like to know how to do it myself!). I already have a menu item for minimize to tray (on the view menu), but need it this way too. TIA! Dave LeBlanc
G'day Dave, Re: The icon problem. Have you edited the 32x32 pixel icon and forgotten to do the 16x16 version? Been there, done that... :-) There's a drop list just above the icon editing window to let you select the size of icon to work on. Sorry, I cant help with the minimizing problem, but there's a CP article here that might set you straight. Hope this helps. Steve
-
Hi; My first post... silly and simple questions, but i've poured through MS Disaster Network (MSDN) and Wrox "Professional MFC 6.0", and can't find answers to easy questions. I've done these in the past, but it's been so long that i've forgotten how. First, how in the blink do you add a custom app icon (upper left corner icon)? I modified the stock Wizard supplied icon (the building blocks one) and yet, the app doesn't use it! It's in the project and the IDR_MAINFRAME rc is pointing at the correct file but... argh! Secondly, I need to intercept both the minimize button on the right of the title bar and also the minimise menu item on the system menu so that when the user clicks on those, I can minimize to the tray instead of the task bar - client requirement (and i'd like to know how to do it myself!). I already have a menu item for minimize to tray (on the view menu), but need it this way too. TIA! Dave LeBlanc
Take a loot at this article: http://www.codeproject.com/gdi/replaceicon.asp Enjoy! :cool:
-
Hi; My first post... silly and simple questions, but i've poured through MS Disaster Network (MSDN) and Wrox "Professional MFC 6.0", and can't find answers to easy questions. I've done these in the past, but it's been so long that i've forgotten how. First, how in the blink do you add a custom app icon (upper left corner icon)? I modified the stock Wizard supplied icon (the building blocks one) and yet, the app doesn't use it! It's in the project and the IDR_MAINFRAME rc is pointing at the correct file but... argh! Secondly, I need to intercept both the minimize button on the right of the title bar and also the minimise menu item on the system menu so that when the user clicks on those, I can minimize to the tray instead of the task bar - client requirement (and i'd like to know how to do it myself!). I already have a menu item for minimize to tray (on the view menu), but need it this way too. TIA! Dave LeBlanc
You need a handler for WM_SYSCOMMAND message. Maybe something like this:
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
CFrameWnd::OnSysCommand(nID, lParam);if (nID == SC\_MINIMIZE) { // Do your stuff here // like maybe call ShowWindow(SW\_HIDE) // or something? }
}
Don't forget to add ON_WM_SYSCOMMAND() to the message map:). HTH, peter