How do I set my program to run in the bottom right corner (above the clock, etc.) regardless of the user's screen resolution? I want my form to have its bot. right corner in the screen's bot. right corner...
Printable View
How do I set my program to run in the bottom right corner (above the clock, etc.) regardless of the user's screen resolution? I want my form to have its bot. right corner in the screen's bot. right corner...
I Smell API Calls, but I don't personally know which ones (Yet).
**Bump**
this will move it to the bottom right of the screen. not sure about the task bar part though
VB Code:
Private Sub Form_Load() Me.Left = Screen.Width - Me.Width Me.Top = Screen.Height - Me.Height End Sub
Damn that was too easy....The only problem is the Task Bar Height.
well the taskbar height most like involves the API (as said) or retrieving a value from the registry...Quote:
Originally posted by mbeverley
Damn that was too easy....The only problem is the Task Bar Height.
Here is how to get the position of the task bar.VB Code:
Private Declare Function AppBarMessage Lib "shell32.dll" Alias "SHAppBarMessage" (ByVal dwMessage As Long, pData As APPBARDATA) As Long 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 ' message specific End Type Private BarData As APPBARDATA Private MyPos As String Private Const ABM_GETTASKBARPOS As Long = &H5& Private Sub GetTaskBarPos() Dim WhereAmI As Long BarData.cbSize = Len(BarData) WhereAmI = AppBarMessage(ABM_GETTASKBARPOS, BarData) MyPos = "Top = " & BarData.rc.Top & vbCrLf 'contains top most position MyPos = MyPos & "Bottom = " & BarData.rc.Bottom & vbCrLf 'contains bottom most position MyPos = MyPos & "Left = " & BarData.rc.Left & vbCrLf 'contains far left position MyPos = MyPos & "Right = " & BarData.rc.Right & vbCrLf 'contains far right position MsgBox MyPos End Sug
Hack Dude,
This wasn't even my original post, but I appreciate the code. You can bet I put that in my code library.
Michael
I figured it would come in handy if Scorpion965 was going to try and calculate what the bottom, right, of his screen would be, taking into consideration the position of the task bar. :)
i think that expert programmers like code more then objects
but beginners like objects more, so if you don't want to think about all this code, you can get the taskbar's height using a control called SysInfo