|
-
Jun 21st, 2001, 01:25 AM
#1
Thread Starter
Frenzied Member
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?
-
Jun 21st, 2001, 08:36 AM
#2
Works for me:
VB Code:
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 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
Private Sub Command1_Click()
Dim lhWnd As Long
lhWnd = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString)
lhWnd = FindWindowEx(lhWnd, 0, "Button", vbNullString)
MoveWindow lhWnd, 0, 0, 20, 20, 1
End Sub
-
Jun 21st, 2001, 12:23 PM
#3
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|