473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem with SHAppBarMessage

Hi group,
I have this code for create a appbar like windows taskbar, but don't work :(
If remove the next line from Button1_Click
SHAppBarMessage(ABM_REMOVE, abd)
when finish app keep desktop area and work perfectly when restart app
Please help!!
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Code "

Public Sub New()
MyBase.New()

InitializeComponent()

End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

Private components As System.ComponentModel.IContainer

Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(8, 8)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(74, 36)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Declare Function SHAppBarMessage Lib "shell32.dll" Alias
"SHAppBarMessage" (ByVal dwMessage As Integer, ByRef pData As APPBARDATA) As
Integer
Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Integer,
ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer,
ByVal cX As Integer, ByVal cY As Integer, ByVal wFlags As Integer) As Integer
Structure APPBARDATA
Dim cbSize As Integer
Dim hwnd As Integer
Dim uCallbackMessage As [Delegate]
Dim uEdge As Integer
Dim rc As RECT
Dim lParam As Integer ' message specific
End Structure
Structure RECT
Dim Left As Integer
Dim Top As Integer
Dim Right As Integer
Dim Bottom As Integer
End Structure
Const ABE_LEFT As Integer = 0
Const ABE_TOP As Integer = &H1
Const ABE_RIGHT As Integer = 2
Const ABE_BOTTOM As Integer = 3

Const ABM_NEW As Integer = 0
Const ABM_REMOVE As Integer = 1
Const ABM_QUERYPOS As Integer = 2
Const ABM_SETPOS As Integer = &H3
Const ABM_GETSTATE As Integer = 4
Const ABM_GETTASKBARPOS As Integer = 5
Const ABM_ACTIVATE As Integer = 6
Const ABM_GETAUTOHIDEBAR As Integer = 7
Const ABM_SETAUTOHIDEBAR As Integer = 8
Const ABM_WINDOWPOSCHANGED As Integer = 9

Const ABS_AUTOHIDE As Integer = 1
Const ABS_ALWAYSONTOP As Integer = 2

Const HWND_NOTTOPMOST As Integer = -2
Const HWND_TOPMOST As Integer = -1
Const HWND_TOP As Integer = 0
Const SHOWNORMAL As Integer = 5

Const SWP_NOMOVE As Integer = 2
Const SWP_NOSIZE As Integer = 1
Const SWP_NOZORDER As Integer = 4
Const SWP_NOACTIVATE As Integer = &H10
Const SWP_DRAWFRAME As Integer = &H20
Const SWP_SHOWWINDOW As Integer = &H40

Dim abd As APPBARDATA
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
abd.hwnd = Me.Handle.ToInt32
abd.cbSize = Len(abd)
With abd
.uEdge = ABE_RIGHT
.rc.Top = 0
.rc.Left = Screen.PrimaryScreen.Bounds.Width - 100
.rc.Right = Screen.PrimaryScreen.Bounds.Width
.rc.Bottom = Screen.PrimaryScreen.Bounds.Height
SHAppBarMessage(ABM_NEW, abd)
SetWindowPos(abd.hwnd, HWND_TOP, .rc.Left, .rc.Top, .rc.Right -
..rc.Left, .rc.Bottom, SWP_SHOWWINDOW Or SWP_NOACTIVATE)
SHAppBarMessage(ABM_SETPOS, abd)
End With
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
SHAppBarMessage(ABM_REMOVE, abd)
End
End Sub
End Class

Jan 17 '06 #1
0 1002

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
2
by: danspam | last post by:
Has anyone managed to get this shell api call to work in vb.net? I keep getting a system.nullreference exception when trying to use it. My code works fine in vb6 but when I translate it to vb.net...
1
by: danspam | last post by:
Thanks for the replies but they did not help me as I am trying to regiseter a form as an appbar and C sharp is no good to me! Anyway my code is as follows. If anyone can spot what I am doing...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
4
by: Daavi | last post by:
Hi group, I have this code for create a appbar like windows taskbar, but don't work :( If remove the next line from Button1_Click SHAppBarMessage(ABM_REMOVE, abd) when finish app keep desktop...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.