Below is the MB Source that will get the number of monitors, screen width,
system font size [small=96px large=120px]
For some cards, especially nVidia MX series there is a flaw in 'doze where
it will report only one monitor of a dual head card and then 'doze will only
use a *big desktop*
This appears with the Start Bar across both monitors instead of just the
Primary
So checking the Screen Width [scrWidth] is it is 2048 then user has 2
monitors on 1024x768 resolution each in *big desk*
otherwise [TI, Rage, etc chipsets] NumMonitors will be 2 with width of 1024
as this code only tests the primary monitor
In *true dual mode* you can have differents resolutions on each monitor but
the code and APIs get even worse for EnumDisplayDevices() and get the
dmPelsWidth by cycling the number of monitors from 0 to NumMonitors-1.

Download AllAPI from http://www.mentalis.org/agnet/apiguide.shtml it has
helped me alot

-------- CODE START --------
'
' get screen resolution from video card
'
DECLARE SUB Main
Define SM_CMONITORS 80 '' decimal value
DEFINE SM_CXSCREEN 0
DEFINE SM_CYSCREEN 1
DEFINE LOGPIXELSX 88 '' decimal value

Declare Function GetDesktopWindow Lib "user32" () As Integer
Declare Function GetDC Lib "user32" (ByVal hwnd As Integer) As Integer
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Integer, ByVal
nIndex As Integer) As Integer
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Integer, ByVal hdc As
Integer) As Integer
Declare Function GetSystemMetrics Lib "user32" Alias "GetSystemMetrics"
(ByVal nIndex As Integer) As Integer
Dim NumMonitors AS Integer
Dim scrWidth AS Integer
Dim hWndDesk AS Integer
Dim hDCDesk AS Integer
Dim logPix AS Integer
Dim r AS Integer

SUB MAIN
  hWndDesk = GetDesktopWindow()
  hDCDesk = GetDC(hWndDesk)
  logPix = GetDeviceCaps(hDCDesk, LOGPIXELSX)
  r = ReleaseDC(hWndDesk, hDCDesk)
  print chr$(12)
  NumMonitors = GetSystemMetrics(SM_CMONITORS)
  print "Number of Monitors = " + NumMonitors
  scrWidth = GetSystemMetrics(SM_CXSCREEN)
  print "Screen Pixel Width = " + scrWidth
  print "Pixels Per Inch = " + logPix
  print "Screen Width Inches = "+format$(scrWidth/logPix,"#0.0###")
END SUB
-------- CODE END --------

Trey Pattillo
[EMAIL PROTECTED]
www.wap3.com
N27.799013 W-97.665322

----- Original Message -----
From: "Matt Bolton" <[EMAIL PROTECTED]>
To: "Scott Walsh" <[EMAIL PROTECTED]>
Cc: "MI-L" <[EMAIL PROTECTED]>
Sent: Monday, December 15, 2003 17:20
Subject: Re: MI-L Application Window Position with 2 Monitors? (Resend)


> Scott,
>
> I know how to do it in VB, but that won't help you. I'm pretty confident
> there's an API call you can use for it, but I can't tell you what it is
> and have no experience using APIs in Mapbasic.
> Have a look at http://www.mentalis.org/apilist/GetSystemMetrics.shtml. I
> think this only returns values in pixels, but there should be a simple
> conversion to inches.
>
> Good luck.  If you find anything useful, I'd be interested in hearing
> about it.
>
> Matt
>
>
>
> Scott Walsh wrote:
>
> > Thanks to Litea and Matt for your quick response.  Your solution did
> > work Matt, but I was wondering if there is way to read the Height and
> > Width of the user's screen in MapBasic and then adjust your
> > application window according to that setting?  I'm using an ATI video
> > card and looked around in there, but couldn't see anything where I
> > could define startup etc...
> >
> > If not I'll use Matt's solution. Thanks everyone!
> > Scott
> >
> > Matt Bolton wrote:
> >
> >> Scott,
> >>
> >> I asked a similar question a few weeks ago (18 Nov 2003). Check out
> >> that thread for some useful info.
> >>
> >> The solution to my problem (sounds similar to yours) was to add the
> >> following line to the mapinfo.mnu file:
> >>    Set Window 1011 Position ( -0.05, -0.05) Width 14.73 Height 11
> >>
> >> You may need to fiddle with the numbers a bit for your 17" (change
> >> the 14.73 to 16.73 and the 11 to an appropriate value)
> >>
> >> Matt
> >>
> >>
> >>
> >> Scott Walsh wrote:
> >>
> >>> List,
> >>>
> >>> I have a MI application that I'm running on a PC with 2 monitors. I
> >>> want the MI application to position itself in the right monitor at a
> >>> certain size (17" monitor) etc....(I know how to set a map within
> >>> the application, but what about the actual application window itself?)
> >>>
> >>> Thanks in advance!
> >>>
> >>> Scott Walsh
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> List hosting provided by Directions Magazine | www.directionsmag.com |
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail:
[EMAIL PROTECTED]
> >>> Message number: 9495
> >>>
> >>> .
> >>>
> >>
> >
> >
> > .
> >
>
> --
> Matt Bolton
>
> Mach 3 IT
>
> Mobile 0412 122 416
> Email  [EMAIL PROTECTED]
>
>
>
>
>
>
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 9564
>
>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 12/11/2003


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9567

Reply via email to