Results 1 to 3 of 3

Thread: [RESOLVED] Application appear above taskbar

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2009
    Posts
    47

    Resolved [RESOLVED] Application appear above taskbar

    Hi

    So heres a image of what I'm trying to do
    http://i34.tinypic.com/ofax51.png

    My application is a toolbar sort of thing.. I want it to be stuck to the user's taskbar and the '::'s in the example will be draggable areas so they can move the toolbar left and right above the taskbar.

    What I need help doing is:

    1. How can I get my app to stick to the users taskbar? I know I cant set the position to mine because different screen resolutions etc, is it possible to do?

    2. How can I make the draggable areas only drag left and right and not up and down?

    Any help appreciated thanks

  2. #2
    Addicted Member
    Join Date
    Oct 2009
    Posts
    212

    Re: Application appear above taskbar

    Most things are possible to do if you know how..

    Code:
        Declare Function FindWindow Lib "user32" Alias _
        "FindWindowA" (ByVal lpClassName As String, ByVal _
        lpWindowName As String) As Integer
    
        Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As IntPtr, ByRef lpwndpl As WINDOWPLACEMENT) As Integer
    
        Private Structure POINTAPI
            Public x As Integer
            Public y As Integer
        End Structure
    
        Private Structure RECT
            Public Left As Integer
            Public Top As Integer
            Public Right As Integer
            Public Bottom As Integer
        End Structure
    
        Private Structure WINDOWPLACEMENT
            Public Length As Integer
            Public flags As Integer
            Public showCmd As Integer
            Public ptMinPosition As POINTAPI
            Public ptMaxPosition As POINTAPI
            Public rcNormalPosition As RECT
        End Structure
    Then make a call like so (I have no idea if this works on any version other than xp sp2, you just have to test it)

    Code:
            Dim wpTemp As WINDOWPLACEMENT
            Thwnd = FindWindow("Shell_traywnd", "")
            GetWindowPlacement(Thwnd, wpTemp)
            'wpTemp.rcNormalPosition has the information you need
    From wpTemp.rcNormalPosition you can get the taskbars current location. Use This information to set your forms location. As for how to keep it docked, handle those events that would allow it to move and limit its movements.

    There's probably a much easier way, which someone wiser might point out..
    Maybe this helped, maybe not...
    Have you tried Google?

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2009
    Posts
    47

    Re: Application appear above taskbar

    Lol just googled and came across this code

    Code:
            
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
        e As System.EventArgs) Handles MyBase.Load
        Dim working_area As Rectangle = _
            SystemInformation.WorkingArea
        Dim x As Integer = _
            working_area.Left + _
            working_area.Width - _
            Me.Width
        Dim y As Integer = _
            working_area.Top + _
            working_area.Height - _
            Me.Height
        Me.Location = New Point(x, y)
    End Sub
    Makes the form go to the bottom corner above the taskbar lol

    Thanks for the help anyway

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width