473,398 Members | 2,368 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,398 software developers and data experts.

shappbarmessage

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 it chokes.
tia
dan
Nov 20 '05 #1
2 2527
Hi,

When upgrading api calls look at the msdn documentation. If a
parameter is in use byval, out use byref. The new integer is the same as
the old long. Callback functions are now delegate. The old integer is the
same as the new short. Window handles hwnd are now given as intptr.
Declare Function SHAppBarMessage Lib "shell32.dll" Alias "SHAppBarMessage" _

(ByVal dwMessage As Integer, ByRef pData As APPBARDATA) As Integer

Structure APPBARDATA

Dim cbSize As Integer

Dim hwnd As IntPtr

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 ABS_AUTOHIDE = &H1

Const ABS_ONTOP = &H2

Const ABM_GETSTATE = &H4

Const ABM_GETTASKBARPOS = &H5

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim abd As APPBARDATA

Dim ret As Integer

abd.hwnd = Me.Handle

SHAppBarMessage(ABM_GETTASKBARPOS, abd)

ret = SHAppBarMessage(ABM_GETSTATE, abd)

If (ret And ABS_AUTOHIDE) Then Debug.WriteLine("Autohide option is on")

If (ret And ABS_ONTOP) Then Debug.WriteLine("Always on top option is on")

Dim strOut As String

strOut = String.Format("Coordinates are ({0}, {1}) - ({2}, {3})", _

abd.rc.Left, abd.rc.Top, abd.rc.Right, abd.rc.Bottom)

Debug.WriteLine(strOut)

End Sub

Ken

-------------------------

"danspam" <sa*******@hotmail.com> wrote in message
news:01****************************@phx.gbl...
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 it chokes.
tia
dan

Nov 20 '05 #2
* "danspam" <sa*******@hotmail.com> scripsit:
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 it chokes.


Fred Balsinger: A Windows Forms Application Desktop Toolbar
<http://www.gotdotnet.com/userfiles/FredB/AppBars.zip>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

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

Similar topics

6
by: Guy Hall | last post by:
I've created a news feeder application for my business, the news bar sizes itself to the screen width and positions itself at the top of the screen. The trouble with this is it can be hidden by...
2
by: KalleD | last post by:
Why can I not move the windows taskbar with the SHAppBarMessage function? I am able to use the function for hiding it and other things, but not moving it (I have unchecked the lock). The code is...
3
by: Mauro | last post by:
How can i resize (autoSize) the Quick Launch Toolbar? I try to send TB_AUTOSIZE Message to it but doesn't work. :-( Thx. Mauro. -- Questa è una firma automatica di MesNews. Sito:...
0
by: mito | last post by:
hello, I have following problem. I need to move window taskbar for example from bottom to right side. ??? I tried APPBARDATA abd ={ sizeof( APPBARDATA ) }; ::SHAppBarMessage(...
2
by: Doug | last post by:
I hope someone can help me. I'm trying to create as part of my application an ApplicationBar (similar to Yahoo and trillian). I've done the research and found that all the examples are for C++...
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...
0
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...
4
by: adrian.bennett | last post by:
I am trying to dock a form to the desktop like the taskbar is but I have been unable to figure out how to do this. Can anyone help? Thanks
3
zybernau
by: zybernau | last post by:
Hi everyone, how to find the position of the right bottom corner of the screen i need to design a form and make it display in the right bottom corner , this should work even in various...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.