Results 1 to 23 of 23

Thread: Placing a form right above the TASKBAR?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    45

    Question Placing a form right above the TASKBAR?

    Hi All.


    I'm trying to make a form popup just above the clock, just above the TASKBAR.


    If the taskbar is NOT on the bottom, then i want the form to appear on the bottom of the screen please.


    i have ABSOULTLY NO IDEA where to start my research for this...

    Any help / links / suggesstions please.

    Thank you kindly.

    -PK-

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    does code count as help

    here you go :

    Code:
    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

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    45
    DUDE!

    you are a legend! I now have a new sugar daddy......


    that is EXACTLY the answer i was after. It's perfect.


    Thank you kindly.


    *respect*


    Now to add a timer, which slowly opens and closes the window HEIGHT and off we go =)
    -PK-

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    No probs

    Why do you need to put it there?

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    45
    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.....

    *sigh*

    -PK-

  6. #6
    Junior Member
    Join Date
    Nov 2000
    Location
    Kalpetta,Wayanad,Kerala,india
    Posts
    25

    Wink taskbar

    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
    Attached Files Attached Files

  7. #7

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    45
    why are you hard-coding the numbers for
    LEFT and TOP ??


    eg...

    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



    'magic numbers' i tend to stay away from.....


    -PK-

  8. #8
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    where'd u get that code from?

  9. #9
    Junior Member
    Join Date
    Nov 2000
    Location
    Kalpetta,Wayanad,Kerala,india
    Posts
    25

    Red face taskbar

    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
    Attached Files Attached Files

  10. #10

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    45
    brijmohank :: I used da_silvy's code because 1) it's cleaner / smaller. 2) it doesn't include hardcoded numbers. [just personal opinion]

    Thank you both for the code, nonetheless.


    I've now implimented da_silvy's code, adding my own additions, like a timer that grows and shrinks the height (like MSN MESSENGER).

    My next question regarding this code (both versions), is how to make the window SHOW, when the main form window is minimized.

    --CURENTLY-- i call PositionForm(). BY DEFAULT, the window is HIDDEN. (ie just LOADED).

    I then reset the height to 120, show the form, then start the timer. when the timer finishes, it UNLOADS the form (me)

    works perfectly, but the form is NOT SHOWN if the main program (which calls the instance of it) is minimized.....

    do you need to see my MAIN FORM CODE?

    -PK-

  11. #11
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Placing a form right above the TASKBAR?

    It might be worth while you checking out the code I have attached here.

    This is code for popup messages, that have the following features.

    • Clickable Message link
    • Add progress bar into message
    • Message shows above all other windows
    • Change virtually all properties to customise message
    • set background pic
    • set logo
    • close when clicked
    • good scrolling
    • play sound when displayed
    • close button in top right hand corner
    • hide message as it's loading
    • store deafult messages and show them at any time
    • Set parent object of messages, so you can display inside an app/picture box
    • plus many many more...

    The code contains a full demo and source code.
    Very small code, very easy to change.

    Just run Test.vpg

    Hope this helps. Still developing it, so any suggestions welcome.

    Woka
    Attached Files Attached Files

  12. #12
    New Member
    Join Date
    Dec 2004
    Posts
    7

    Re: Placing a form right above the TASKBAR?

    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.

  13. #13

  14. #14
    Junior Member
    Join Date
    Nov 2001
    Location
    UK WMids
    Posts
    24

    Re: Placing a form right above the TASKBAR?

    Hi all
    Is there a vb.net way around this?
    Just be nice to know, that's all.

    Thanks.

  15. #15
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Edgerton, WI
    Posts
    381

    Re: Placing a form right above the TASKBAR?

    brijmohank,

    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

  16. #16
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Edgerton, WI
    Posts
    381

    Re: Placing a form right above the TASKBAR?

    da_silvy,

    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.

    Thanks for any help or advise that you can give.

    Michael

  17. #17
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Placing a form right above the TASKBAR?

    Quote Originally Posted by Rev. Michael L. Burns
    brijmohank,

    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.

  18. #18
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Edgerton, WI
    Posts
    381

    Re: Placing a form right above the TASKBAR?

    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.

    Michael

  19. #19
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Red face Re: Placing a form right above the TASKBAR?

    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

  20. #20
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Placing a form right above the TASKBAR?

    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 ..
    Last edited by rory; Jun 23rd, 2006 at 02:16 AM.

  21. #21
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: Placing a form right above the TASKBAR?

    Quote Originally Posted by rory
    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

  22. #22
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Placing a form right above the TASKBAR?

    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 ..?

    Rory

  23. #23
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Placing a form right above the TASKBAR?

    You may find my project MSM Popup Messages quite handy.
    The link is in my sig. This sould have all the code you could want for this.

    Woka

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width