How to have all open windows set to a specific size and location on form load

Hi all,

I am working on XP and when my Form1 is loaded, I'd like to have all the open windows (explorer, IE, Excel, Word... whatever) set to a special size: 1080,990 and to a new location point : 0,0 (so top left corner) and I'd like also all of the applications that will be opened after that to have those properties as well.

My form1 needs to go to location 1080,0.

Yes, I'm trying to create a second taskbar that will be on the right hand-side (you clever-clogs would have understood that already I bet) with special stuff on it but that's another story.

Is it possible under VB?
touyetsAsked:
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.

dentabCommented:
Sub Form_Load
  me.Top = 0
  me.Left = 0
  me.Height = 990
  me.Width = 1080
End Sub
0
dentabCommented:
If you wanted the Form to be the screen width, alter the sub to be

Sub Form_Load
  me.Top = 0
  me.Left = 0
  me.Height = 990
  me.Width = screen.width
End Sub

Also, the forms can be set using properties if the borderstyle is changed to be fixed and not resizable
0
dentabCommented:
woops..

"My form1 needs to go to location 1080,0"

I think you want this:

  me.Top = 0
  me.Left = screen.width-me.width
0
The Ultimate Tool Kit for Technolgy Solution Provi

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 for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

touyetsAuthor Commented:
Thanks for that but what about the other windows?

Quote from original question:
"I'd like to have all the open windows (explorer, IE, Excel, Word... whatever is already open before I  open my application) set to a special size: 1080,990 and to a new location point : 0,0 (so top left corner) and I'd like also all of the applications that will be opened after that to have those properties as well."
0
dentabCommented:
ah
sorry... right

thats a much bigger problem and means enumerating processes..
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
touyetsAuthor Commented:
ou!!! okay... not gonna do that :)

Thanks
0
dentabCommented:
thankyou, I has just started looking into how for you.  It would involve API, and I will find what I can if you are still interested.
0
touyetsAuthor Commented:
Definetly
0
dentabCommented:
0
dentabCommented:
and for moving and resizing...
Public Enum SetWindowPosFlags
  SWP_NOACTIVATE = &H10
  SWP_NOCOPYBITS = &H100
  SWP_NOMOVE = &H2
  SWP_NOOWNERZORDER = &H200      '  Don't do owner Z ordering
  SWP_NOREDRAW = &H8
  SWP_NOSIZE = &H1
  SWP_NOZORDER = &H4
End Enum
 
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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 SetWindowPosFlags) As Long
 
Public Sub MoveWindowByHandle(byval hwnd As Long, byval Left As Long, Byval Top As Long)
 
Call SetWindowPos(hwnd, 0, Left, Top, 0, 0, SWP_NOSIZE + SWP_NOZORDER + SWP_NOACTIVATE)
 
End Sub

Open in new window

0
dentabCommented:
If you have difficulty putting the two together, let me know and I'll take a gander later on.  I know its not strait forward.

Best of luck!
DenTab
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.