0
votes

All.

I'm attempting to develop a 'sidebar' application with vb6, which I want to behave like windows Vista's gadget sidebar or Google Desktop sidebar, in the respect that other windows could not maximize over it. I'm aware that chances of this happening are probably very little, but I'm asking just in case.

Currently, I've got a form that has multiple controls, and runs a function on load which makes itself the exact height of the screen, minus the taskbar, and it's 'left' location is set by a timer to be 'screen.width - me.width', so it will start at full height on the far right of the screen, and cannot be moved. Code for the height is as follows, if it is necessary.

Declare Function GetUserNameA Lib "advapi32.dll" (ByVal lpBuffer As String, nSize As Long) As Long

Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
            ByVal hwnd As Long, _
            ByVal nIndex As Long) As Long

Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
            ByVal hwnd As Long, _
            ByVal nIndex As Long, _
            ByVal dwNewLong As Long) As Long

Public Declare Function SetLayeredWindowAttributes Lib "user32" ( _
            ByVal hwnd As Long, _
            ByVal crKey As Long, _
            ByVal bAlpha As Byte, _
            ByVal dwFlags As Long) As Long

Public Const GWL_STYLE = (-16)
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_LAYERED = &H80000
Public Const LWA_COLORKEY = &H1
Public Const LWA_ALPHA = &H2


Private Const ABM_GETTASKBARPOS = &H5

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long
End Type

Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long

Function Fixheight()
Dim ABD As APPBARDATA

SHAppBarMessage ABM_GETTASKBARPOS, ABD

Form1.Height = Screen.Height - ((ABD.rc.Bottom - ABD.rc.Top) * 12)
If Form1.Height <= 600 Then
Form1.Height = Screen.Height
End If
End Function

To be clear, I do not want an 'always on top' function. I already have that, and it's driving me insane, as the form has to me closed or minimized in order to maximize, minimize of close another program (i.e. chrome, word, etc) behind it. This form must instead not allow other programs to maximize over it, so that if for example, the user maximized Chrome, chrome would maximize minus form1.width. I doubt that this is possible because as far as I'm concerned, that would mean taking control of chrome, and essentially making it's maximize function as me.height = screen.height - ((ABD.rc.Bottom - ABD.rc.Top) * 12) me.width = screen.width - form1.width which isn't possible.

Anyway, hopefully someone out there can help. As I said, I seriously doubt the possibility of having this work, but if so, all the better.

Thanks in advance!

1
You're never going to implement this in your own code manually. There's an API for that; see MSDN's docs for SHAppBarMessage.Ken White
Right...you'd register your AppBar with ABM_NEW, then set it's position with ABM_SETPOS, specifying ABE_RIGHT in the APPBARDATA structure you passed in.Idle_Mind

1 Answers

0
votes

Thanks to Ken White, I googled SHAppBarMessage and found the following website, offering a downloadable source with the very feature I needed. I just have to implement it now!!

Very glad I asked! Thank you!

Edit: Found this spanish website, which while needed some help from Google Translate, is more suited to my needs. Just need to figure out how to make it work on the Right Hand Side! Thanks again!