positioning the console ?
-
- User
- Posts: 47
- Joined: Tue Sep 02, 2003 9:17 am
- Location: Belgium
- Contact:
positioning the console ?
Hello,
Is it possible to place the console window at a certain screen position? Maybe with an API command?
Is it possible to place the console window at a certain screen position? Maybe with an API command?
Re: positioning the console ?
Sure, but only after it's opened. Try this (to position the window at 10,10 on the Desktop):
And here's how you'd center the console window on the Desktop:
Code: Select all
If OpenConsole()
ConsoleTitle("Test Console") : x=10 : y=10 ; Pixel position on screen.
SetWindowPos_(FindWindow_(0,"Test Console"),0,x,y,0,0,#SWP_NOSIZE)
Delay(5000) ; Wait for 5 seconds so you can see the result.
EndIf
Code: Select all
If OpenConsole()
dtw=GetSystemMetrics_(#SM_CXSCREEN) : dth=GetSystemMetrics_(#SM_CYSCREEN)
ConsoleTitle("Test Console") : con=FindWindow_(0,"Test Console")
GetWindowRect_(con,win.RECT) : w=win\right-win\left : h=win\bottom-win\top
SetWindowPos_(con,0,(dtw-w)/2,(dth-h)/2,0,0,#SWP_NOSIZE)
Delay(5000) ; Wait for 5 seconds so you can see the result.
EndIf
-
- User
- Posts: 47
- Joined: Tue Sep 02, 2003 9:17 am
- Location: Belgium
- Contact:
-
- User
- Posts: 39
- Joined: Tue Nov 25, 2003 12:28 pm
You can set size of the window using the same method.
Code: Select all
If OpenConsole()
ConsoleTitle("Test Console")
x=200
y=200
width=500
height=500
SetWindowPos_(FindWindow_(0,"Test Console"), 0, x, y, width, height, #SWP_SHOWWINDOW)
Delay(5000) ; Wait for 5 seconds so you can see the result.
EndIf
> You can set size of the window using the same method.
No -- the console's actual window may be larger, but the output isn't,
which is why I answered no to resizing. Try doing this in the bigger
window and you'll see what I mean:
No -- the console's actual window may be larger, but the output isn't,
which is why I answered no to resizing. Try doing this in the bigger
window and you'll see what I mean:
Code: Select all
If OpenConsole()
ConsoleTitle("Test Console")
x=200
y=200
width=500
height=500
SetWindowPos_(FindWindow_(0,"Test Console"), 0, x, y, width, height, #SWP_SHOWWINDOW)
For r=1 To 500 : PrintN(Str(r)) : Next
Delay(5000) ; Wait for 5 seconds so you can see the result.
EndIf
-
- User
- Posts: 39
- Joined: Tue Nov 25, 2003 12:28 pm
-
- User
- Posts: 47
- Joined: Tue Sep 02, 2003 9:17 am
- Location: Belgium
- Contact:
-
- User
- Posts: 47
- Joined: Tue Sep 02, 2003 9:17 am
- Location: Belgium
- Contact:
Here's how to get the resolution:
Code: Select all
Width = GetSystemMetrics_(#SM_CXSCREEN)
Height= GetSystemMetrics_(#SM_CYSCREEN)
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
-
- User
- Posts: 47
- Joined: Tue Sep 02, 2003 9:17 am
- Location: Belgium
- Contact: