Results 1 to 3 of 3

Thread: Resize Start Button

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Question Resize Start Button

    I am trying to resize the start button.
    I've seen it done before.
    Code:
    Option Explicit
    
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" 
        (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, 
        ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    
    Dim LHWND As Long
    Dim SRECT As RECT
    Dim RWIDTH As Long
    Dim RHEIGHT As Long
    
    Private Sub Form_Load()
        LHWND = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString)
        LHWND = FindWindowEx(LHWND, 0, "Button", vbNullString)
        
        GetWindowRect LHWND, SRECT
        RHEIGHT = SRECT.Bottom - SRECT.Top
        RWIDTH = SRECT.Right - SRECT.Left
      
        MoveWindow LHWND, SRECT.Left, SRECT.Top, RWIDTH + 10, RHEIGHT, True
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        MoveWindow LHWND, SRECT.Left, SRECT.Top, RWIDTH, RHEIGHT, True
    End Sub
    MoveWindow does not seem to have any effect on the button.
    Any suggestions?

  2. #2
    Megatron
    Guest
    Works for me:
    VB Code:
    1. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    2. Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    3.  
    4. Private Sub Command1_Click()
    5.     Dim lhWnd As Long
    6.     lhWnd = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString)
    7.     lhWnd = FindWindowEx(lhWnd, 0, "Button", vbNullString)
    8.  
    9.     MoveWindow lhWnd, 0, 0, 20, 20, 1
    10. End Sub

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    Yes, this does work for an instant and then the start button is
    resized to normal. I want it to stay the size I set it to.

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