Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_GETWORKAREA = 48
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Sub PositionForm()
Dim WindowRect As RECT
SystemParametersInfo SPI_GETWORKAREA, 0, WindowRect, 0
Form1.Top = WindowRect.Bottom * Screen.TwipsPerPixelY - Form1.Height
Form1.Left = WindowRect.Right * Screen.TwipsPerPixelX - Form1.Width
End Sub
I've made a simple VB program that downloads some XML from my MUD Game.
My VB Client the shows the people ONLINE, and also lists those people, who YOU have nominated in another XML file (locally stored) that are friends, as either ONLINE or OFFLINE.
Now, you code allows me to have a POP-UP window occur whenever a certain STATUS occurs == EG. user has come online or offline or either.
=)
But my bloody MS Internet Transfer Control object is not very nice ... it hangs the program -only when i quit- for a few seconds [only after I have succesfully grabbed my xml / html from da net...]
If only there was some other -FREE- OCX out there i could use for grabbing an html / xml page from a website.....
Can you try this one,
this will put the form always above the task bar
even at different screen resolutions.
I saw your thread also did not know
'system parameter info' can do this .
i wrote this one seeing your query, so please do reply
on a form put a timer and paste the following code
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim cd As Boolean
Dim a, b As RECT
Private Sub Form_Load()
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Dim hwnd As Long
hwnd = FindWindow("Shell_TrayWnd", vbNullString)
GetWindowRect hwnd, b
If b.Left = -2 And (b.Right = 802 Or b.Right = 1026 Or b.Right = 642 Or b.Right = 722) And b.Top = -2 Then
Me.Top = (b.Bottom) * 15
Me.Left = Screen.Width - Me.Width - 30
Else
If b.Left = -2 And (b.Right = 802 Or b.Right = 1026 Or b.Right = 642 Or b.Right = 722) And (b.Bottom = 602 Or b.Bottom = 770 Or b.Bottom = 482 Or b.Bottom = 578) Then
Me.Top = b.Top * 15 - (Me.Height)
Me.Left = Screen.Width - Me.Width - 30
Else
If b.Top = -2 And (b.Bottom = 602 Or b.Bottom = 770 Or b.Bottom = 482 Or b.Bottom = 578) And (b.Right = 802 Or b.Right = 1026 Or b.Right = 642 Or b.Right = 722) Then
Me.Top = Screen.Height - Me.Height - 30
Me.Left = (Screen.Width - Me.Width - (b.Right - b.Left) * 15) + 30
Else
If b.Left = -2 And b.Top = -2 And (b.Bottom = 602 Or b.Bottom = 770 Or b.Bottom = 482 Or b.Bottom = 578) Then
Me.Top = Screen.Height - Me.Height - 30
Me.Left = ((b.Right - b.Left) * 15) - 30
End If
End If
End If
End If
End Sub
did u use the zip file ,if you use it u will understand
it clearly.
the numbers -2 etc denotes the left of taskbar
and the others 802,1026 etc used to get the
screen resolution,I gurantee that it will work superbly.
even if you change the taskbar location .
please try the zip file ,see the working.
if u've any doubts i'll clear it for u
waiting to hear from u
thanks
Im doing a similar grow event form for a chat program I'm making, these methods really help, up until now I had it hard coded to work with 1024x768 only.
I tried your menu program that you gave as a zipped example. It looks and works great. However, I can't get rid of it now. It runs whenever I start windows. How can I prevent this?
I am trying to make a launch bar similar to the Microsoft Office Bar. I am using your code example given in this thread to position my form above the task bar. It seems to work great. How can I get my form to recognize if the taskbar has changed. For instance, it positions itself now above the taskbar but what if the taskbar is set to autohide? How can I get my form to resize to the new position of the taskbar?
On a unrelated issue, what I am trying to do is make a launchbar on the right of my screen. This works ok and resizes the client area when my bar is visable and resizes when I close my bar. However, I have noticed that everytime I launch and close the launch bar, the actual horizontal width of the client area of my screen gets a little smaller until, if done enough times, I can only see half the screen width above the taskbar although the taskbar is the full width of the screen. How can I prevent this?
On final question, how can I get my launch bar to autohide and resize the client area of the screen? Currently, it is attached to the right of the screen and is an inch wide.
I tried your menu program that you gave as a zipped example. It looks and works great. However, I can't get rid of it now. It runs whenever I start windows. How can I prevent this?
Thanks,
Rev. Michael L. Burns
Well it either has a shortcut in the Start->Startup folder or on the registry...
Has someone helped you? Then you can Rate their helpful post.
Thanks manavo11. Initially I tried the registry but was using the name of the program displayed in the System Tray. When I went back and actually searched on menu.exe I fold the registry entry, deleted it and restarted my computer and all is now well.
Could u guys re upload a working example of resizing and placing an external window right above taskbar in the lower right cornder of screen just above clock. I could not download the first few zip files and the last one was giving tones of error!!Thanks
I just put it into a program of mine by editing it to work with my form .. here is a sample project just using one manual popup ... maybe it will help you .. its stripped down some .. easier to add to existing programs .. the section you edit is the AddPopup on the form1 .. you could add a timer and all that also ..
Rory
Edit . i left some of my program in there LOL ..
anyway i uploaded the changed version ..
I just put it into a program of mine by editing it to work with my form .. here is a sample project just using one manual popup ... maybe it will help you .. its stripped down some .. easier to add to existing programs .. the section you edit is the AddPopup on the form1 .. you could add a timer and all that also ..
Rory
Thanks for u reply. i liked the pop idea. I will be using it for my other project so can u tell me what shouldi change in order that it works for my external window knowing its classname and caption?
Furthermore, at this moment i am just intrested in placeing my external window in that position and leaving it like that not bring it down . How i should do that ? My external window might be in the middle of screen with diffrent size , how i should resize and place it above taskbar without brining it down?Thanks
Well . .. I just made a slight change BTW .. i had a reference to Media Player in there as I was using that in my proggy .. i took it out so you could download the newer one if you like ..
Its actually a popup message .. not an external program ..
uses a form in the project as the pop up ..
Looks like Wokawidget originally developed it .. so he would know the ins and outs more than I :-) But id like to tell him hey its great ...
I think though from reading your other posts .. this might not be the thing for this program of yours .. or it will take some serious editing for it to work with an external program ..
Do you have control over the external program or is it someone elses ..?