Creating a fixed sidebar - Forum

Forum Navigation
You need to log in to create posts and topics.

Creating a fixed sidebar

I want to create a sidebar where other windows cannot enter below or be above. That is, they can only reach the edge of the sidebar. The sidebar should always be visible. Is this possible?
I want a small app like this but for my own tasks.
Thanks in advance for your reply

@pgsuni

Yes, you can get the size and position of the main application window and control its state.
See commands GetWindowPos, SetWindowPos

And also plugin commands:
hpwSendKeys (Hans-Peter Wickern).
zmFunctions 1.0b (Peter Pavlov)
rlFunctions 2.6s (Reynold E. Lariza)
ksFunctions (Igor R.)

Thanks.
I looked at GetWindowPos, SetWindowPos I think I understand how it works. However, I don't know where to find the [AppID]? I tried: sidebar, sidebar.pub, sidebar.exe, SideBar (title)
Unfortunately, I don't understand exactly what to expect here.

GetWindowPos "sidebar" "[X]" "[Y]" "[W]" "[H]"
GetWindowPos "[AppID]" "[X]" "[Y]" "[W]" "[H]"

I understand a lot already, but it caught me :-(

@pgsuni

The [AppID] variable is populated when using the Run or RunInRectangle commands:
https://winhelp.visualneo.com/Applications.html#SETWINDOWPOS

If you want to control application windows that have been run by the user separately from your project, look at plugins. They allow to get identifiers (HWND descriptors) of top windows in the system and manage them.

 

 

Thank you for dealing with me :-)

APP PROPERTIES / ACTIONS / STARTUP:
Run "notepad.exe" "" "Normal+RunOnce" "" "[AppId]"
SetWindowPos "[AppId]" "0" "0" "200" "200"

With this solution, I can adjust the size and position of another EXE window launched by my program. Am I correct?
However, I want to set the position and size for my own basic program.
Eg aligned to the left side of the screen, then aligned to the right side at the touch of a button.

I attached a picture

Uploaded files:
  • You need to login to have access to uploads.

@pgsuni

Try this demonstration file. To test it, compile it first and run the compiled application (not F9, that is, you should not run the test compilation, but the compiled application). This is required because the SetWindowPos command uses the filename of the application which has a postfix in the test compilation.

I used the zmFunctions 1.0b plugin (Peter Pavlov) to get the desktop coordinates. The English version of the plugin is available here:

Uploaded files:
  • You need to login to have access to uploads.
PGSuni has reacted to this post.
PGSuni

OK now that's how I'm starting to understand :-)
The zmFunctions 1.0b plugin (Peter Pavlov) looks good for several things :-)
Thanks for the help.

@pgsuni

However, I want to set the position and size for my own basic program.
Eg aligned to the left side of the screen, then aligned to the right side at the touch of a button.

There are predefined variables for this ... you will find them on this Help page ...  Predefined Global Variables (visualneo.com)

... including ...

[WindowLeft] The screen Y location of the upper left of the publication window.
[WindowTop] The screen X location of the upper left of the publication window.
[WindowWidth] The width of the publication window including the border and scroll bars (if any).
[WindowHeight] The height of the publication window including the title bar, border and scroll bars (if any).
[WindowState] The display state of the publication window (Normal, Minimized or Maximized).

[PubWidth] The width of the interior of the publication window (the client area).
[PubHeight] The height of the interior of the publication window (the client area).

Vadim and PGSuni have reacted to this post.
VadimPGSuni

Yes, these variables are used in the example above. The plugin is only needed to get the size of the desktop area not hidden by the taskbar.

 

Thank you both :-)
Now I can position and manage both my own and external windows.

However, something is not right yet:
Using this, realtime prints as I move, resize the windows, so it's OK.
WindowLeft: [WindowLeft]
WindowTop: [WindowTop]
WindowWidth: [WindowWidth]
WindowHeight: [WindowHeight]
WindowState: [WindowState]
ScreenHeight: [ScreenHeight]
ScreenWidth: [ScreenWidth]

However, when I say the window should be MAXMINIZED, unfortunately the dimensions are not good.
The upper left corner is at -8 -8 pixels.
And width isn’t really what it should be.

The resolution of the monitor at which it starts: 2560x1440 pixels.
Pure mystery :-)

What do you think this might be?

I built a 4 monitor system for myself which works perfectly well.
But maybe you're getting involved here for some reason? I can't think of anything else.

Uploaded files:
  • You need to login to have access to uploads.

@pgsuni

Try pausing the debugger and running the code line by line. Determine the line where the variables take on a value you don't expect. This will allow you to catch the moment when the code doesn't do what you intended. That way you can determine the cause and fix it.

Unfortunately, I just had time to use the program again.
Debug doesn't show me a bug
If the program sets the left side of the window to 0 pixels, the values are 0 pixels everywhere.
But visually, at -10 pixels would actually be the edge of the screen.
I did a test little app. Ls is an image where you can see that it does not completely go to the edge of the screen.
I got stuck I don't know what the problem might be.

Uploaded files:
  • You need to login to have access to uploads.

There is a small app here that can be aligned to the edge of the monitor or just to the center with a few buttons.

ZIP->windowpos.pub

Uploaded files:
  • You need to login to have access to uploads.
luishp, Vadim and proforma.guyot have reacted to this post.
luishpVadimproforma.guyot

@pgsuni

I have tested your sample. It works fine for me (see video). Does this pattern work for you by leaving space on the left?

If so, maybe you should calibrate your monitor. Monitors have an auto-tuning function.

For some reason the video does not play (writes that the file is damaged), so I put it in the archive.

Uploaded files:
  • You need to login to have access to uploads.

@pgsuni

Uploaded files:
  • You need to login to have access to uploads.

@pgsuniThis is deployed in full screen. - 8 This is probably the window frame.

 

Uploaded files:
  • You need to login to have access to uploads.
luishp has reacted to this post.
luishp

AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It contains a small app (Au3Info.exe) that can easily determine the exact ID, Handle, etc. of any running program just by dragging the Finder Tool over its window.

https://www.autoitscript.com/site/