Moving other application's windows
Posted on 2003-11-05
I have an application that's a Shell App bar that runs at the top of the screen.
We have a poorly written app that we use for our customer database... problem is, this application slowly moves upwards in increments at screen resolutions of 1024x768 or higher for some reason. Eventually, it works its way underneath my app bar.
So, I want my app bar to "bump" windows down X pixels if they take over (or under technically) its space. I'll probably fire it when a user moves their mouse over my App Bar or even clicks it; I think I'd need to scan for all open windows, and if their window hwnd is within the top X pixels, bump them down Y pixels...
Here's the abstract code of what I'm trying to do:
For Each Window that's not maximized
If The Top Position of the Window is within X pixels of the top of the screen Then
Move this window down Y pixels
I'm no API expert and I can't get past Enumerating Unmaximized, open windows. I would think I would need to use EnumWindows ; IsWindowVisible() ; GetWindowText ; GetWindowRect ; ClientToScreen ; ScreenToClient ; MoveWindow ; SetWindowPos.
Can anyone convert this to real, working VB6 code (NOT using .NET!)?