April 27, 2024, 02:57:30 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


OpenWindow

Started by Brian, April 28, 2012, 06:13:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

Hi,

Now I'm sure I've seen this before somewhere, but what's the best way of opening
a window according to the user's screen size, and whether or not there
is a Taskbar showing, without the user having to resize the window manually?

Brian

ZeroDog

I've tried various things, unfortunately, the taskbar seems to be a fickle thing.  For example, the following works just fine, so long as the taskbar is at the bottom of the screen (regardless of how big it is), however, as soon as you move the taskbar to the top or sides of your screen, it has issues.

DECLARE import,SystemParametersInfoA(uAction:INT, uParam:INT, lpvParam:POINTER, fuWinIni:INT),INT
CONST SPI_GETWORKAREA = 48
def workrect:winrect
systemparametersinfoA(SPI_GETWORKAREA, 0,workrect,0)

def win:window
openwindow win, workrect.left, workrect.top, workrect.right,workrect.bottom, @CAPTION, 0, "SystemParametersInfo Test", &winproc

run=1
waituntil run=0
end

sub winproc(),int
select @class
case @idclosewindow
run=0
endselect
return 0
endsub

Andy

Hi Brian,

Hope you're well, have a look at the attachment - it's one of the browser examples.

It changes it's screen size to fit the users screen, I changed it so it maximizes to full screen. I moved the taskbar around the screen i.e. top, left, right, and bottom, and I think maybe this is what your are after.

Larry is the expert on this code but there is a sub routine called resizeall  used after the openwindow command.

Alternatively, there is also a command:
You could use the GETSCREENSIZE screenW,screenH to find the size of the screen and use
openwindow  win,0,0, screenW,screenH .............


Hope some of this helps,
Andy.
:)


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

ZeroDog

GETSCREENSIZE will return the current screen resolution, and will not take the user's taskbar into consideration.

Andy

Thanks ZD,

I think then the browsertest attachment example might be the way to go for Brian?

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Hi,

Thanks for your replies - just going to have a look at them. Meanwhile, what I came
up with myself was:

DECLARE IMPORT,GetSystemMetrics(item:INT),INT
WINDOW win
GETSCREENSIZE screenW,screenH
OPENWINDOW win,0,0,screenW,screenH-GetSystemMetrics(13),@MINBOX|@MAXBOX|@SIZE,0,"Window Test",&main

This appears to allow for the taskbar at the bottom. What I haven't tested is whether
the taskbar is at any other place than the bottom of the screen

GETSCREENSIZE for me on it's own didn't allow for the taskbar

Brian

Egil

Brian,
I no longer have any copies of EB/IWB on my computers, so I can not test this out myself. But after opening the program as shown in your last post, try GETCLIENTSIZE to see if it takes care of the taskbar position.

Good luck!

Egil
Support Amateur Radio  -  Have a ham  for dinner!

ZeroDog

QuoteGetSystemMetrics(13)

I'm confused.  That would return the width of the cursor (CONST SM_CXCURSOR = 13):
QuoteSM_CXCURSOR,
SM_CYCURSOR
Width and height, in pixels, of a cursor. These are the cursor dimensions supported by the current display driver. The system cannot create cursors of other sizes.

If you are using GetSystemMetrics, you could use the following flags:
SM_CXMAXIMIZED,
SM_CYMAXIMIZED
Default dimensions, in pixels, of a maximized top-level window.

CONST SM_CXMAXIMIZED = 61
CONST SM_CYMAXIMIZED = 62


In theory, a maximized window should take the taskbar into account, regardless of it's position and size.


LarryMc

Quote from: Egil on April 29, 2012, 06:09:27 AM
Brian,
I no longer have any copies of EB/IWB on my computers, so I can not test this out myself. But after opening the program as shown in your last post, try GETCLIENTSIZE to see if it takes care of the taskbar position.

Good luck!

Egil
GETCLIENTSIZE gets the client size of a window; not of the user's screen. ;)

Note: Load your IWB back up and come join us again.  We're here everyday. ;D

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library