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. right-click on windows taskbar

right-click on windows taskbar

Scheduled Pinned Locked Moved C / C++ / MFC
linux
4 Posts 3 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.
  • K Offline
    K Offline
    kartikdasani
    wrote on last edited by
    #1

    I need to right-click on the windows taskbar on the button of a particular application and then select one of the actions in the menu (maximize,restore,close/exit). Have been trying to get a handle to the taskbar as follows: HWND hDesktop = GetDesktopWindow(); HWND hTray = FindWindowEx( hDesktop, NULL, _T("Shell_TrayWnd"), NULL ); HWND hReBar = FindWindowEx( hTray, NULL, _T("ReBarWindow32") , NULL ); HWND hTask = FindWindowEx( hReBar, NULL, _T("MSTaskSwWClass") , NULL ); HWND hToolbar = FindWindowEx( hTask, NULL, _T("ToolbarWindow32") , NULL ); But I dont know what to do beyond that or if I am actually getting the correct handle.

    _ A 2 Replies Last reply
    0
    • K kartikdasani

      I need to right-click on the windows taskbar on the button of a particular application and then select one of the actions in the menu (maximize,restore,close/exit). Have been trying to get a handle to the taskbar as follows: HWND hDesktop = GetDesktopWindow(); HWND hTray = FindWindowEx( hDesktop, NULL, _T("Shell_TrayWnd"), NULL ); HWND hReBar = FindWindowEx( hTray, NULL, _T("ReBarWindow32") , NULL ); HWND hTask = FindWindowEx( hReBar, NULL, _T("MSTaskSwWClass") , NULL ); HWND hToolbar = FindWindowEx( hTask, NULL, _T("ToolbarWindow32") , NULL ); But I dont know what to do beyond that or if I am actually getting the correct handle.

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      To do this you can find the Window that you need to work on. Then send it the WM_SYSCOMMAND[^] message. For example to send the restore command -

      SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);

      Here hWnd is the handle returned by FindWindow.

      «_Superman_»  _I love work. It gives me something to do between weekends.

      _Microsoft MVP (Visual C++)

      Polymorphism in C

      K 1 Reply Last reply
      0
      • _ _Superman_

        To do this you can find the Window that you need to work on. Then send it the WM_SYSCOMMAND[^] message. For example to send the restore command -

        SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);

        Here hWnd is the handle returned by FindWindow.

        «_Superman_»  _I love work. It gives me something to do between weekends.

        _Microsoft MVP (Visual C++)

        Polymorphism in C

        K Offline
        K Offline
        kartikdasani
        wrote on last edited by
        #3

        What I want to do is to right-click on a Button on the TaskBar corresponding to a particular running application and then select one of the actions from the Menu that shows. Any suggestions?

        1 Reply Last reply
        0
        • K kartikdasani

          I need to right-click on the windows taskbar on the button of a particular application and then select one of the actions in the menu (maximize,restore,close/exit). Have been trying to get a handle to the taskbar as follows: HWND hDesktop = GetDesktopWindow(); HWND hTray = FindWindowEx( hDesktop, NULL, _T("Shell_TrayWnd"), NULL ); HWND hReBar = FindWindowEx( hTray, NULL, _T("ReBarWindow32") , NULL ); HWND hTask = FindWindowEx( hReBar, NULL, _T("MSTaskSwWClass") , NULL ); HWND hToolbar = FindWindowEx( hTask, NULL, _T("ToolbarWindow32") , NULL ); But I dont know what to do beyond that or if I am actually getting the correct handle.

          A Offline
          A Offline
          Abhi Lahare
          wrote on last edited by
          #4

          Try this[^] sample app , you may able to right click on the menu items HTH

          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