hi all,
i have a program that change the look of the taskbar. But i have a problem, i want to set the start button position to the middle of the taskbar but can't find any code to do this. I know that its possible because there are some programs that do this. i hope you guys can help me out thanks already :)

killerbeat

Recommended Answers

All 11 Replies

hi all,
i have a program that change the look of the taskbar. But i have a problem, i want to set the start button position to the middle of the taskbar but can't find any code to do this. I know that its possible because there are some programs that do this. i hope you guys can help me out thanks already :)

killerbeat

Hello,
An (Windows) Executable file (*.exe) has a know place, where are stored some pictures. This way you can change some pictures in it. But changing the "core" layout would need to change the code. I doubt there are applications, that can do it (1), you should try an alternative to Windows Explorer which provide the way to modiby the look and feel.

Hello,
An (Windows) Executable file (*.exe) has a know place, where are stored some pictures. This way you can change some pictures in it. But changing the "core" layout would need to change the code. I doubt there are applications, that can do it (1), you should try an alternative to Windows Explorer which provide the way to modiby the look and feel.

seten, i now it's possible please look at this program:
http://www.blogsdna.com/5018/move-windows-xp-start-button-system-tray-on-taskbar.htm
(this program is coded in vb ) i only have no idea how to do it :(

Hi

I hope you are familiar with Win32API.

use MoveWindow() or SetWindowPos() API to move start menu

Hi

I hope you are familiar with Win32API.

use MoveWindow() or SetWindowPos() API to move start menu

selvaganapathy, i am not really familiar with the win 32API can you tell me some more about it?

Please read the MSDN reference for MoveWindow() API

http://msdn.microsoft.com/en-us/library/ms633534%28VS.85%29.aspx

SetWindowPos() API
http://msdn.microsoft.com/en-us/library/ms633545%28VS.85%29.aspx

Example

1. Draw three Buttons ( Button1, Button2, Button3 )
then try this

Imports System.Runtime.InteropServices

Public Class Form1

    Shared ReadOnly SWP_NOSIZE As UInt32 = Convert.ToUInt32(&H1)    'Ignore Width and Height

    <DllImport("user32.dll")> _
    Public Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Boolean) As Boolean
    End Function

    <DllImport("user32.dll", SetLastError:=True)> _
    Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As UInt32) As Boolean
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Move the Button3 to 0, 0 and Keep Same Width
        MoveWindow(Button3.Handle, 0, 0, Button3.Width, Button3.Height, True)
        'Move the Button2 to 100, 100
        SetWindowPos(Button2.Handle, IntPtr.Zero, 100, 100, 0, 0, SWP_NOSIZE)
    End Sub
End Class

Please read the MSDN reference for MoveWindow() API

http://msdn.microsoft.com/en-us/library/ms633534%28VS.85%29.aspx

SetWindowPos() API
http://msdn.microsoft.com/en-us/library/ms633545%28VS.85%29.aspx

Example

1. Draw three Buttons ( Button1, Button2, Button3 )
then try this

Imports System.Runtime.InteropServices

Public Class Form1

    Shared ReadOnly SWP_NOSIZE As UInt32 = Convert.ToUInt32(&H1)    'Ignore Width and Height

    <DllImport("user32.dll")> _
    Public Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Boolean) As Boolean
    End Function

    <DllImport("user32.dll", SetLastError:=True)> _
    Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As UInt32) As Boolean
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Move the Button3 to 0, 0 and Keep Same Width
        MoveWindow(Button3.Handle, 0, 0, Button3.Width, Button3.Height, True)
        'Move the Button2 to 100, 100
        SetWindowPos(Button2.Handle, IntPtr.Zero, 100, 100, 0, 0, SWP_NOSIZE)
    End Sub
End Class

tnx selvaganapathy, but how can i find the start button window and move it ? with the code you gave me you can move 2 buttons but how do you do this with windows

but i thought already you have the code...

no problem, google it you will find the code

or

See this discussion http://bytes.com/topic/visual-basic-net/answers/366425-how-hide-start-button

now i am realy lost :icon_confused: how do find the start button and move it ? i think this part of the code i have to change please help

'Move the Button3 to 0, 0 and Keep Same Width
        MoveWindow(Button3.Handle, 0, 0, Button3.Width, Button3.Height, True)
        'Move the Button2 to 100, 100
        SetWindowPos(Button2.Handle, IntPtr.Zero, 100, 100, 0, 0, SWP_NOSIZE)

Full Code that u want, Try it

Imports System.Runtime.InteropServices
Public Class Form1

    <DllImport("user32.dll")> _
    Public Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Boolean) As Boolean
    End Function

    <DllImport("user32.dll", SetLastError:=True)> _
    Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As UInt32) As Boolean
    End Function

    <DllImport("user32.dll")> _
    Public Shared Function FindWindowEx(ByVal hWnd As IntPtr, ByVal hWndChild As IntPtr, ByVal lpszClassName As String, ByVal lpszWindow As String) As IntPtr
    End Function

    <DllImport("user32.dll")> _
    Public Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Int32) As Int32
    End Function
    Public Shared ReadOnly SWP_NOSIZE As UInt32 = Convert.ToUInt32(&H1)    'Ignore Width and Height

    Private m_hWndStart As IntPtr
    Private m_hWndTaskBar As IntPtr

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        m_hWndTaskBar = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", vbNullString)
        m_hWndStart = FindWindowEx(m_hWndTaskBar, IntPtr.Zero, "BUTTON", vbNullString)

        'Move the Start Menu to 100, 0
        SetWindowPos(m_hWndStart, IntPtr.Zero, 100, 0, 0, 0, SWP_NOSIZE)
    End Sub

End Class

Full Code that u want, Try it

Imports System.Runtime.InteropServices
Public Class Form1

    <DllImport("user32.dll")> _
    Public Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Boolean) As Boolean
    End Function

    <DllImport("user32.dll", SetLastError:=True)> _
    Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As UInt32) As Boolean
    End Function

    <DllImport("user32.dll")> _
    Public Shared Function FindWindowEx(ByVal hWnd As IntPtr, ByVal hWndChild As IntPtr, ByVal lpszClassName As String, ByVal lpszWindow As String) As IntPtr
    End Function

    <DllImport("user32.dll")> _
    Public Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Int32) As Int32
    End Function
    Public Shared ReadOnly SWP_NOSIZE As UInt32 = Convert.ToUInt32(&H1)    'Ignore Width and Height

    Private m_hWndStart As IntPtr
    Private m_hWndTaskBar As IntPtr

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        m_hWndTaskBar = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", vbNullString)
        m_hWndStart = FindWindowEx(m_hWndTaskBar, IntPtr.Zero, "BUTTON", vbNullString)

        'Move the Start Menu to 100, 0
        SetWindowPos(m_hWndStart, IntPtr.Zero, 100, 0, 0, 0, SWP_NOSIZE)
    End Sub

End Class

thank you so much this was where i was searching for :D i have only question can you move the start button and start menu seperatly?

i dont know how to separate start button and start menu or separately move each one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.