Get Position of Taskbar button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mikeymike
    New Member
    • Jul 2009
    • 12

    Get Position of Taskbar button

    This is specifically for Windows 7, but any insight would be great. My app currently starts up and shows a form at the cursor position, but this is not feasible for what I would like as the user can quickly move the mouse after launching the application. So how would I got about getting the position of the task bar button and showing the window there?
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    Founded in 1997, DEVShed is the perfect place for web developers to learn, share their work, and build upon the ideas of others.



    It looks like you need to use some of the windows dlls to make the call you need, which means you'll need to make use of DLLImport. I won't try to explain it here because I'm pretty new at using it myself, and don't have a good understanding of the windows libraries themselves.

    Google should be able to help you figure out what you need, or hopefully someone here with more experience in that area can help you. Those two links should get you started though.

    Good luck!

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      Correct me if I am wrong but... The taskbar is on the primary monitor. That's what makes that monitor "primary", right? So just get the WorkingArea of the primary screen.

      Do a little reading on MSDN for System.Windows. Forms.Screen.Al lScreens;

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        When you say taskbar button, you mean the launcher that sits in the menu bars (similar to the "quick launch" bar in XP)?
        Why does your form need to popup right next to the launcher?

        Comment

        • mikeymike
          New Member
          • Jul 2009
          • 12

          #5
          My program pops up like an extension of the task bar to perform some things, that is why I need it to be over the top of the button clicked.

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            Are you saying it acts like a context menu for any button (application) on the task menu? So you want your form to open directly above some other program button in the task bar?

            So if I have "notepad" open, there is a "notepad" button on the taskbar. You want your program's form to open right above the "notepad" button in the taskbar when I click on the "notepad" button? Is that right?

            Comment

            • mikeymike
              New Member
              • Jul 2009
              • 12

              #7
              tlhintoq, that is exactly what i'm talking about =)

              Comment

              • tlhintoq
                Recognized Expert Specialist
                • Mar 2008
                • 3532

                #8
                What happens with the standard behavior of clicking on a taskbar button if your app is intercepting it?

                Comment

                • tlhintoq
                  Recognized Expert Specialist
                  • Mar 2008
                  • 3532

                  #9
                  You know you can't just go with "above" the button, right?
                  Taskbar can be moved to the top of the screen, or left or right sides.

                  Instead of basing your opening on the current cursor position, what about basing it on the position when then the mouse was clicked?

                  Comment

                  • mikeymike
                    New Member
                    • Jul 2009
                    • 12

                    #10
                    Yes, I'm aware it can be moved. I'm doing it via cursor position because clicking the button launches my application as it is pinned to the task bar (Windows 7).

                    Comment

                    • tlhintoq
                      Recognized Expert Specialist
                      • Mar 2008
                      • 3532

                      #11
                      Taskbar buttons are still just part of a controls collection. You should be able to go through them to get their positions. Just like going through a collection of controls on a form to get all the buttons, textboxes, labels etc. Right?

                      Comment

                      Working...