473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Programming for multiple monitors

I'm testing some 3rd-party software and I noticed that the application
doesn't remember which monitor it was last running on and always opens on my
primary monitor. This got me thinking that if I were ever to write an app
for widespread distribution, I'd want to go the extra mile and add this
funcrtionality to it to give it that extra professional touch. So how do I
do it? What class, if any, would give me this kind of information? Do I have
to use P/Invoke?
Jun 15 '07 #1
3 1710
I haven't tested it because I only have one monitor, but when your app
closes, just remember the last position it was on (Top, Left,
WindowState)... And when it starts again, put this position right back and
voilà!!

I used this since VB 3 and it always worked, so I don't see why it wouldn't
work anymore... ;)

good luck

ThunderMusic

"Jeff Johnson" <i.***@enough.spamwrote in message
news:eT**************@TK2MSFTNGP04.phx.gbl...
I'm testing some 3rd-party software and I noticed that the application
doesn't remember which monitor it was last running on and always opens on
my primary monitor. This got me thinking that if I were ever to write an
app for widespread distribution, I'd want to go the extra mile and add
this funcrtionality to it to give it that extra professional touch. So how
do I do it? What class, if any, would give me this kind of information? Do
I have to use P/Invoke?

Jun 15 '07 #2
Hi!

If you remember position, don't forget to check, if the saved position is
now valid. For example if you remove a monitor, or work with
terminalservice.

Wolfgang
"ThunderMusic" <No*************************@NoSpAm.comschrieb im
Newsbeitrag news:Oh**************@TK2MSFTNGP06.phx.gbl...
>I haven't tested it because I only have one monitor, but when your app
closes, just remember the last position it was on (Top, Left,
WindowState)... And when it starts again, put this position right back and
voilà!!

I used this since VB 3 and it always worked, so I don't see why it
wouldn't work anymore... ;)

good luck

ThunderMusic

"Jeff Johnson" <i.***@enough.spamwrote in message
news:eT**************@TK2MSFTNGP04.phx.gbl...
>I'm testing some 3rd-party software and I noticed that the application
doesn't remember which monitor it was last running on and always opens on
my primary monitor. This got me thinking that if I were ever to write an
app for widespread distribution, I'd want to go the extra mile and add
this funcrtionality to it to give it that extra professional touch. So
how do I do it? What class, if any, would give me this kind of
information? Do I have to use P/Invoke?


Jun 15 '07 #3
Jeff Johnson wrote:
I'm testing some 3rd-party software and I noticed that the
application doesn't remember which monitor it was last running on and
always opens on my primary monitor. This got me thinking that if I
were ever to write an app for widespread distribution, I'd want to go
the extra mile and add this funcrtionality to it to give it that
extra professional touch. So how do I do it? What class, if any,
would give me this kind of information? Do I have to use P/Invoke?
Normally, windows will remember, and if you use for example ultramon,
it works OK. My .NET application doesn't have any logic build in for
its main app location with multimonitor setups, but it starts up on the
monitor I closed it on, because windows takes care of that.

That's not true for child windows though. So if you have your main app
on monitor 2, and you open a dialog which is moved to monitor 1 by the
user, and you close the app, the dialog will be placed at monitor 2,
very likely (unless you choose the useless setting of letting windows
handle where the dialog pops up which is always not the location you
want it to be).

In that case, check out the DesktopBounds property of a form. :) Set
the saved DesktopBounds struct of a previous location it in the Load
event handler of the form and everything is good.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Jun 16 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Fred Moses | last post by:
Windows GDI has support for multiple display monitors. How do I gain access to comparable facilities in the .NET Foundation Class Library from C#?
1
by: JMM | last post by:
I'm writing a control program that will require a lot of screen real estate to interact with the user. One thought I had on how to do this was to use a dual output display adapter and two...
1
by: Jordan Wright | last post by:
Not sure if this is simple or hard, but I will simplify what I am trying to do. I want to display images on two different monitors. One fullscreen on the 2nd monitor, and one not fullscreen on...
3
by: Lizim | last post by:
Does anybody know if it is possible to write software that works across multiple monitors? and if so, is it possible to program one so it is private to the user / administrator and the other...
3
by: Steve | last post by:
Hello-- I have made a C# executable that monitors the server it is placed on. This works great so far. Since I don't have physical access to this machine, I have my executable launched by...
0
by: Ian Rutherford | last post by:
I'm currently trying to do something with VB .net that I'm having a lot of difficulty with. Basically, I need to be able to display a form on any monitor I choose. So, I have to enumerate all...
0
by: Brian | last post by:
I have an small graphical app in c# where a main form controls the graphical data on two other forms depending on input data. I am looking for a way to direct these two controlled forms to be...
1
by: jaiello | last post by:
We have writen a script for a user confirmation reboot of the machine. Our computers have 3 monitors and we would like the popup box to display on all three monitors to make sure the user sees it as...
30
by: Jakle | last post by:
I have been googling, but can seem to find out about C GUI libraries. My main platform is Windows, but it would be nice to find a cross platform library. I've been programming with php, which...
1
by: Peter Huish | last post by:
My application runs on a system that has 2 monitors. Currently if I display a dialog box it will display on the monitor that currently has focus. Is there a mechanism to have the dialog display...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.