VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Creates a new start menu button.

by Bird (7 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 13th June 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Creates a new start menu button.

API Declarations


Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const SW_HIDE = 0
Const SW_NORMAL = 1
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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Dim tWnd As Long, bWnd As Long, ncWnd As Long

Rate Creates a new start menu button.



    Dim R As RECT
    tWnd = FindWindow("Shell_TrayWnd", vbNullString)
    bWnd = FindWindowEx(tWnd, ByVal 0&, "BUTTON", vbNullString)
    GetWindowRect bWnd, R
    ncWnd = CreateWindowEx(ByVal 0&, "BUTTON", "Bird", WS_CHILD, 0, 0, R.Right - R.Left, R.Bottom - R.Top, tWnd, ByVal 0&, App.hInstance, ByVal 0&)
    ShowWindow ncWnd, SW_NORMAL
    ShowWindow bWnd, SW_HIDE
End Sub
Private Sub Form_Load()
NewStart
End Sub

Private Sub Form_Unload(Cancel As Integer)
    ShowWindow bWnd, SW_NORMAL
    DestroyWindow ncWnd
End Sub


Download this snippet    Add to My Saved Code

Creates a new start menu button. Comments

No comments have been posted about Creates a new start menu button.. Why not be the first to post a comment about Creates a new start menu button..

Post your comment

Subject:
Message:
0/1000 characters