|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
get users screen resolutionI want to programatically get the user's screen resolution so that I can
bring up a different screen depending on whether they are set at 800x600 or 1024x768. Thanks for any help. -- Bruce L "Bruce L" <Bru***@discussions.microsoft.com> wrote in message Screen.Width / Screen.TwipsPerPixelXnews:4252117C-EB1E-413A-B110-5E7F07F4A44F@microsoft.com... >I want to programatically get the user's screen resolution so that I can > bring up a different screen depending on whether they are set at 800x600 > or > 1024x768. I leave it to you to figure out the height. MsgBox Screen.Width / Screen.TwipsPerPixelX & " - " & Screen.Height /
Screen.TwipsPerPixelY Steve Show quoteHide quote "Bruce L" <Bru***@discussions.microsoft.com> wrote in message news:4252117C-EB1E-413A-B110-5E7F07F4A44F@microsoft.com... >I want to programatically get the user's screen resolution so that I can > bring up a different screen depending on whether they are set at 800x600 > or > 1024x768. > Thanks for any help. > -- > Bruce L "Steve Barnett" <non***@nodomain.com> wrote in message What is that supposed to do?news:%23AV8WVsvFHA.3080@tk2msftngp13.phx.gbl... > > MsgBox Screen.Width / Screen.TwipsPerPixelX & " - " & Screen.Height / > Screen.TwipsPerPixelY > "Dave" <Nob***@Nowhere.Com> wrote in message What the original person asked for, return the screen resolution.!!news:ukRdL71vFHA.3588@tk2msftngp13.phx.gbl... > > "Steve Barnett" <non***@nodomain.com> wrote in message > news:%23AV8WVsvFHA.3080@tk2msftngp13.phx.gbl... > > > > MsgBox Screen.Width / Screen.TwipsPerPixelX & " - " & Screen.Height / > > Screen.TwipsPerPixelY > > > What is that supposed to do? > >
Show quote
Hide quote
"Nospam" <nospam@please.co.uk> wrote in message Well sort of, he wanted code not a message box and it has the cardinal sin news:up8GJ$1vFHA.1716@TK2MSFTNGP10.phx.gbl... > > "Dave" <Nob***@Nowhere.Com> wrote in message > news:ukRdL71vFHA.3588@tk2msftngp13.phx.gbl... >> >> "Steve Barnett" <non***@nodomain.com> wrote in message >> news:%23AV8WVsvFHA.3080@tk2msftngp13.phx.gbl... >> > >> > MsgBox Screen.Width / Screen.TwipsPerPixelX & " - " & Screen.Height / >> > Screen.TwipsPerPixelY >> > >> What is that supposed to do? >> >> > > What the original person asked for, return the screen resolution.!! > of mixing types, the numbers should really be enclosed with a CStr() or Str() to explicitly convert them into strings. Sure it almost always works like that but every now and then it will fail and will be tricky to track down, far better to develop good habits now so if you learn another less forgiving language you already have the discipline. Regards Dave O.
Show quote
Hide quote
"Dave" <Nob***@Nowhere.Com> wrote in message You asked "What is that supposed to do?" and I answered.news:egYU0Q3vFHA.916@TK2MSFTNGP10.phx.gbl... > > "Nospam" <nospam@please.co.uk> wrote in message > news:up8GJ$1vFHA.1716@TK2MSFTNGP10.phx.gbl... > > > > "Dave" <Nob***@Nowhere.Com> wrote in message > > news:ukRdL71vFHA.3588@tk2msftngp13.phx.gbl... > >> > >> "Steve Barnett" <non***@nodomain.com> wrote in message > >> news:%23AV8WVsvFHA.3080@tk2msftngp13.phx.gbl... > >> > > >> > MsgBox Screen.Width / Screen.TwipsPerPixelX & " - " & Screen.Height / > >> > Screen.TwipsPerPixelY > >> > > >> What is that supposed to do? > >> > >> > > > > What the original person asked for, return the screen resolution.!! > > > > Well sort of, he wanted code not a message box and it has the cardinal sin > of mixing types, the numbers should really be enclosed with a CStr() or > Str() to explicitly convert them into strings. Sure it almost always works > like that but every now and then it will fail and will be tricky to track > down, far better to develop good habits now so if you learn another less > forgiving language you already have the discipline. > > > > Regards > > Dave O. > You did not say that there were bad practices in the example. I agree that the example was poor (it was not provided by me!), but it give the required info in an easy to test (and read) form. It would be up to the person using the example to convert the code into a form suitable for his application. John.. It shows the poster the resolution of the monitor. Had the poster asked for
a complete application, I probably would not have bothered to post. What I did do, however, was offer enough information to be able to solve the posters problem, without coding all of the work for them. I guess you have nothing better to do with your time. I do. Steve Show quoteHide quote "Dave" <Nob***@Nowhere.Com> wrote in message news:ukRdL71vFHA.3588@tk2msftngp13.phx.gbl... > > "Steve Barnett" <non***@nodomain.com> wrote in message > news:%23AV8WVsvFHA.3080@tk2msftngp13.phx.gbl... >> >> MsgBox Screen.Width / Screen.TwipsPerPixelX & " - " & Screen.Height / >> Screen.TwipsPerPixelY >> > What is that supposed to do? > "Steve Barnett" <non***@nodomain.com> wrote in message Hey Steve, take no notice of Dave. He probably just got out of the wrong news:OKMy643vFHA.460@TK2MSFTNGP15.phx.gbl... > It shows the poster the resolution of the monitor. Had the poster > asked for a complete application, I probably would not have > bothered to post. side of the bed this morning! I'm sure that the OP appreciated your response, and was very thankful that you took the time out to answer him. Mike My fault - I shouldn't rise to the bait.
Caught me at a bad time - I'd just got back from a meeting with a client - four and a half hour round trip in the car for a 20 minute meeting where I was asked (by a man who hadn't read any of the documentation I sent him) whether there would be any problems installing a new version of our software. This was not helped by the torn ligament in my shoulder - just what you want with four and a half hours behind the wheel. Steve Show quoteHide quote "Mike Williams" <M***@WhiskyAndCoke.com> wrote in message news:dgurmv$re5$1@news8.svr.pol.co.uk... > "Steve Barnett" <non***@nodomain.com> wrote in message > news:OKMy643vFHA.460@TK2MSFTNGP15.phx.gbl... > >> It shows the poster the resolution of the monitor. Had the poster >> asked for a complete application, I probably would not have >> bothered to post. > > Hey Steve, take no notice of Dave. He probably just got out of the wrong > side of the bed this morning! I'm sure that the OP appreciated your > response, and was very thankful that you took the time out to answer him. > > Mike > > > > > > I want to programatically get the user's screen resolution so that I can Multiple monitors are becoming more popular these days, so what happens if the user has one 1024*768 and one 800*600 display> bring up a different screen depending on whether they are set at 800x600 or > 1024x768. attached to their machine? The VB Screen object returns information on the primary monitor but not necessarily the largest, if you need to know that then grab the multi-monitor library off my page which will expose all this additional information for you (and also works on single-monitor setups.) Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/
Other interesting topics
[VB6] Passing the variable value to the form?
Fluctuation of printer alignment Database and report question Newbie: How to extract year from a Date object VB6 : Attach Event Handlers to Dynamically Generated Controls How can i make sure msgbox problem List all jpg files from folder (loop problem) Random first random number delete |
|||||||||||||||||||||||