1. OT: XP Dual Monitor Detection

Under Windows XP, does anybody have a system call to detect if the user is 
using dual monitors? I have a resize routine that got too smart on itself 
and won’t allow you to save the window’s position if it thinks that you’re 
“off the screen”. Unfortunately, that translates to off the primary screen 
only. Thanks!

Yours, OtterDad

Don't sweat it -- it's not real life. It's only ones and zeroes. Gene Spafford

new topic     » topic index » view message » categorize

2. Re: OT: XP Dual Monitor Detection

OtterDad wrote:
> 
> Under Windows XP, does anybody have a system call to detect if the user is 
> using dual monitors? I have a resize routine that got too smart on itself 
> and won’t allow you to save the window’s position if it thinks that you’re 
> “off the screen”. Unfortunately, that translates to off the primary screen 
> only. Thanks!
> 
> Yours, OtterDad
> 
> Don't sweat it -- it's not real life. It's only ones and zeroes. Gene Spafford

I don't have much experience with multiple monitors but I think you would have
to call EnumDisplayMonitors(). This function will return a handle and rectangle
for each monitor.

Larry Miller

new topic     » goto parent     » topic index » view message » categorize

3. Re: OT: XP Dual Monitor Detection

Larry Miller wrote:
> 
> OtterDad wrote:
> > 
> > Under Windows XP, does anybody have a system call to detect if the user is 
> > using dual monitors? I have a resize routine that got too smart on itself 
> > and won’t allow you to save the window’s position if it thinks that you’re 
> > “off the screen”. Unfortunately, that translates to off the primary screen 
> > only. Thanks!
> > 
> > Yours, OtterDad
> > 
> > Don't sweat it -- it's not real life. It's only ones and zeroes. Gene
> > Spafford
> 
> I don't have much experience with multiple monitors but I think you would have
> to call EnumDisplayMonitors(). This function will return a handle and
> rectangle
> for each monitor.
> 
> Larry Miller

XP supports up to 10 monitors.

This is the link for info on multiple monitors.

http://msdn2.microsoft.com/en-us/library/ms534609.aspx

The functions and structures are listed under reference subject


Bernie

My files in archive:
WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

4. Re: OT: XP Dual Monitor Detection

thanks to bernie and larry - that's what i was looking for. once successfully
wrapped, i'll publish it.

Yours, OtterDad

Don't sweat it -- it's not real life. It's only ones and zeroes. Gene Spafford

new topic     » goto parent     » topic index » view message » categorize

5. Re: OT: XP Dual Monitor Detection

OtterDad wrote:
> 
> Under Windows XP, does anybody have a system call to detect if the user is 
> using dual monitors? I have a resize routine that got too smart on itself 
> and won�t allow you to save the window's position if it thinks that you're 
> 'off the screen'. Unfortunately, that translates to off the primary screen 
> only. Thanks!

How does it know that you're off the primary screen? 

Every program I write saves the x-y position of the window when it closes in a
.ini file, and puts the window there next time it opens. My observation is that
the co-ordinates simply treat all the screens as one big wide screen. Talking
purely in terms of x-y co-ordinates, the system doesn't seem to care from primary
or secondary.

new topic     » goto parent     » topic index » view message » categorize

6. Re: OT: XP Dual Monitor Detection

Craig Welch wrote:
> 
> OtterDad wrote:
> > 
> > Under Windows XP, does anybody have a system call to detect if the user is 
> > using dual monitors? I have a resize routine that got too smart on itself 
> > and won�t allow you to save the window's position if it thinks that you're
> >
> > 'off the screen'. Unfortunately, that translates to off the primary screen 
> > only. Thanks!
> 
> How does it know that you're off the primary screen? 
> 
> Every program I write saves the x-y position of the window when it closes in
> a .ini file, and puts the window there next time it opens. My observation is
> that the co-ordinates simply treat all the screens as one big wide screen.
> Talking
> purely in terms of x-y co-ordinates, the system doesn't seem to care from
> primary
> or secondary.

my resize system compares getRect(Window or control) against getRect(Screen) 
to make sure user doesn't attempt to move or resize their objects position 
off screen. more than happy for improvement ideas. see below:

-- ====================================================================
global function my_getRect(atom local_hwnd)
    -- get rect dimensions and convert to {x,y,w,h}
    return xyxy2xywh(getRect(local_hwnd))
end function
-- ====================================================================
-- returns {0,0,screen_width,screen_height}
constant screen_pos = my_getRect(Screen)
debug_message("screen pos = " & sprint(screen_pos))
global procedure set_control_pos(atom local_hwnd, sequence local_pos,
    atom repaint)
    -- works to resize any window or control
    -- passed as (hwnd, {x,y,width,height}, repaint_boolean)

    -- check to make sure window is not "off the screen"
	if local_pos[pos_x] > screen_pos[pos_width] or
		local_pos[pos_y] > screen_pos[pos_height] then return end if

    -- ignore if silly values or minimized
    for i = 1 to 4 do if local_pos[i] < 0 then return end if end for

    setRect(local_hwnd, local_pos[pos_x], local_pos[pos_y],
    	local_pos[pos_width], local_pos[pos_height], repaint)
end procedure
-- ====================================================================


Yours, OtterDad

Don't sweat it -- it's not real life. It's only ones and zeroes. Gene Spafford

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu