form always on bottom

There's probably been something about this somewhere else but I can't find it. What I need to know is how to set my form to always be underneath all the other windows. I'm guessing it has something to do with SetWindowPos but I can't find the value I need to set it to. Other methods are also acceptable (or a link). Thanks.
adidasman2k5Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnMcCannCommented:
HWND_BOTTOM = 1
0
adidasman2k5Author Commented:
I tried that, but it only put it at the bottom once, and if the form took focus, it came back to the top. I need it to stay at the bottom all the time.
0
JoaTexCommented:
Hi

Open a Project.
open a module and put the code Module: in it.
Open a Form and put the code Code: in it.

Run the program and your window will be allways on top.

Module:

Option Explicit
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40

Code:

Option Explicit
Dim WidthPixels
Dim HeightPixels
Private Sub Form_Load()
      WidthPixels = Me.Width / Screen.TwipsPerPixelX
      HeightPixels = Me.Height / Screen.TwipsPerPixelY
      SetWindowPos Form1.hwnd, -1, 0, 0, WidthPixels, HeightPixels, &H50 'OnTop
End Sub

If you want not on top instead of -1 on SetWindow Pos put -2.
Jo

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

JohnMcCannCommented:
I would use the HWND_BOTTOM and in the Form_GotFocus event send back to bottom.  Why do you want a form always on bottom?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adidasman2k5Author Commented:
With tweak ui I put moving the mouse over a window gives it focus and made a text form for reminders, kinda like 3m stickies. I want it so that when i click on the form to move the cursor it stays at the bottom so it seems like im writing on my desktop.
0
adidasman2k5Author Commented:
With tweak ui I put moving the mouse over a window gives it focus and made a text form for reminders, kinda like 3m stickies. I want it so that when i click on the form to move the cursor it stays at the bottom so it seems like im writing on my desktop.
0
adidasman2k5Author Commented:
if anyone wants to know, I actually used the mousedown event but it works, so thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.