Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Need help quick on a couple of silly simple problems

Need help quick on a couple of silly simple problems

Scheduled Pinned Locked Moved C / C++ / MFC
c++sysadminhelptutorialquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David LeBlanc
    wrote on last edited by
    #1

    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

    J S A P 4 Replies Last reply
    0
    • D David 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

      J Offline
      J Offline
      Joe Moldovan
      wrote on last edited by
      #2

      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!

      1 Reply Last reply
      0
      • D David 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

        S Offline
        S Offline
        Steve Driessens
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • D David 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

          A Offline
          A Offline
          Ammar
          wrote on last edited by
          #4

          Take a loot at this article: http://www.codeproject.com/gdi/replaceicon.asp Enjoy! :cool:

          1 Reply Last reply
          0
          • D David 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

            P Offline
            P Offline
            Peter Godec
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups