Results 1 to 9 of 9

Thread: Program docking

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    28
    Can someone direct me to a site or code that explains how to dock my program on *any* side of the screen? Something similar to ICQ where it pushes the desktop to the side. I think is has something to do with the registry, but I could be wrong.

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    82
    hi,
    fist of all, you will need to set the form to stick to one of the screen sides.
    to do that you will need to do this:

    to stick to the right:
    in a timer control:
    private sub timer1_timer()
    form1.left=screen.width-form1.left
    end sub

    to stick to the left:
    in a timer control:
    private sub timer1_timer()
    form1.left=0
    end sub

    to stick to the top:
    in a timer control:
    private sub timer1_timer()
    form1.top=0
    end sub

    to stick to the bottom:
    in a timer control:
    private sub timer1_timer()
    form1.top = screen.height - form1.height
    end sub

    the timer must be at interval=1
    now to set the workspace so that the programs and all desktop and all worspace will de as you wish:

    in a module:


    'the rest here in a module
    Public Const SPI_SetWorkArea = 47
    Public Const SPI_GetWorkArea = 48

    Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long

    Public Type tCoord2D
    left As Long
    top As Long
    right As Long
    bottom As Long
    End Type


    Public Function ChangeWorkArea(top As Integer, bottom As Integer, left As Integer, right As Integer)
    Dim Rect As tCoord2D

    Rect.top = top
    Rect.left = left
    Rect.right = right
    Rect.bottom = bottom
    SystemParametersInfo SPI_SetWorkArea, 0, Rect, 0
    End Function

    some where:
    Call ChangeWorkArea(0, Screen.Height / Screen.TwipsPerPixelY, 0, Screen.Width / Screen.TwipsPerPixelX)
    do some tests with these functions to understand them,
    ok hoped i helped, bye.

  3. #3
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    What your after is an Application Toolbar
    (AppBar for short) check out the microsoft site for further info, sorry but i cannot remember the url

    DocZaf
    {;->

  4. #4
    Guest
    Code:
    Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
    
    
    Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    
    
    Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
        End Type
        
        Dim StartMenu As Long
        Dim What As RECT
        
    
    
    Public Sub BorderToRight(FormName As Form)
    
    
        For TempNum = 1 To 999
            TempString$ = Space$(128)
            TempNum2 = GetClassName(TempNum, TempString$, 128)
            TempNum3 = Left$(TempString, TempNum2)
            If LCase(TempNum3) = "shell_traywnd" Then Goto StartMenuFound
        Next TempNum
        StartMenuFound:
        GetWindowRect TempNum, What
        StartMenu = What.Top * 15
    
    
        FormName.Move Screen.Width - FormName.Width, 0, FormName.Width, StartMenu
        End Sub
    
    
    Usage:
    
    BorderToRight Me

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    28
    That just moves the form to the right. I need it to resize the desktop. Ever seen the Microsoft Office Toolbar? It sits at the top and the desktop is resised to fit under it.

  6. #6
    Lively Member
    Join Date
    Jul 2000
    Posts
    82
    hey!!!
    i wrote u how to do that( resize the desktop)
    here is the code again:

    in a module:


    'the rest here in a module
    Public Const SPI_SetWorkArea = 47
    Public Const SPI_GetWorkArea = 48

    Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long

    Public Type tCoord2D
    left As Long
    top As Long
    right As Long
    bottom As Long
    End Type


    Public Function ChangeWorkArea(top As Integer, bottom As Integer, left As Integer, right As Integer)
    Dim Rect As tCoord2D

    Rect.top = top
    Rect.left = left
    Rect.right = right
    Rect.bottom = bottom
    SystemParametersInfo SPI_SetWorkArea, 0, Rect, 0
    End Function

    some where:
    Call ChangeWorkArea(0, Screen.Height / Screen.TwipsPerPixelY, 0, Screen.Width / Screen.TwipsPerPixelX)
    do some tests with these functions to understand them,
    ok hoped i helped, bye.


  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    28
    For some reason the code doesn't resize the desktop. <shrug>

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    28
    Ok this is weird. It *does* resize the screen, but doesn't show it until I resise all of the open windows.

  9. #9
    Lively Member
    Join Date
    Jul 2000
    Posts
    82
    ohh,
    sorry i really dont know why that is, i will try to fix it, give me some time though...
    bye,
    yair

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