ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Switching monitors (https://www.excelbanter.com/excel-programming/409736-switching-monitors.html)

Dave Unger

Switching monitors
 
Hello,

I'm currently working on an application that, as part of its function,
launches various executable files (using the Shell function). The
client has a dual monitor arrangement, and wants to be able to
control, programmatically, which monitor will be used at launch
time.

I’ve done a lot of searching on the Internet, but so far, nothing
quite addresses this issue. I’m thinking that it should be possible
somehow, (possibly an API), seeing as Windows has the capability to
remember the previously used monitor.

I’m hoping someone can help me out, either by pointing me in the right
direction, or, telling me it’s just not possible. Thanks in advance
for your help.

Regards,

Dave U

James Snell

Switching monitors
 
Hi Dave -

You certainly can move & size windows of launched applications and you're
right it would be via the Windows API. I've not done it in a long time
though and it wasn't with multiple displays. To my knowledge the API doesn't
discern between physical screens, it just uses an absolute position based on
0,0 being the top left of screen #1.

Probably the best bet is ask in the group
microsoft.public.win32.programmer.gdi (
http://www.microsoft.com/communities...ogrammer. gdi
) they'll probably be able to give you the API calls without having to look
them up - you'll need the code to identify the window handle (hwnd) of the
window you're looking for and then use that to move it around and resize it.
If you get stuck implementing those in vba then someone here will be able to
help you with that.

Also, I've seen bugs where the target app has not finished launching before
you try to manipulate it in vba (or fails to launch completely) resulting in
unpredictable behaviour. So remember to leave a good opportunity for the app
to start, make sure you've got excellent error handling and push the thread
priority of excel down temporarily to give the other app some cpu time.

~ James


"Dave Unger" wrote:

Hello,

I'm currently working on an application that, as part of its function,
launches various executable files (using the Shell function). The
client has a dual monitor arrangement, and wants to be able to
control, programmatically, which monitor will be used at launch
time.

Ive done a lot of searching on the Internet, but so far, nothing
quite addresses this issue. Im thinking that it should be possible
somehow, (possibly an API), seeing as Windows has the capability to
remember the previously used monitor.

Im hoping someone can help me out, either by pointing me in the right
direction, or, telling me its just not possible. Thanks in advance
for your help.

Regards,

Dave U


Ron de Bruin

Switching monitors
 
Hi Dave

Maybe the creator of this great program can help you
http://www.realtimesoft.com/ultramon/

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Dave Unger" wrote in message ...
Hello,

I'm currently working on an application that, as part of its function,
launches various executable files (using the Shell function). The
client has a dual monitor arrangement, and wants to be able to
control, programmatically, which monitor will be used at launch
time.

I’ve done a lot of searching on the Internet, but so far, nothing
quite addresses this issue. I’m thinking that it should be possible
somehow, (possibly an API), seeing as Windows has the capability to
remember the previously used monitor.

I’m hoping someone can help me out, either by pointing me in the right
direction, or, telling me it’s just not possible. Thanks in advance
for your help.

Regards,

Dave U


Dave Unger

Switching monitors
 
Hi James & Ron,

Many thanks to both of you - both of your suggestions pointed me to
exactly what I was looking for, very helpful.

Thanks again,

regards,

Dave U


On Apr 22, 7:39*am, "Ron de Bruin" wrote:
Hi Dave

Maybe the creator of this great program can help youhttp://www.realtimesoft.com/ultramon/

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm

"Dave Unger" wrote in ...

Hello,

I'm currently working on an application that, as part of its function,
launches various executable files (using the Shell function). *The
client has a dual monitor arrangement, and wants to be able to
control, programmatically, which monitor will be used at launch
time.

I’ve done a lot of searching on the Internet, but so far, nothing
quite addresses this issue. *I’m thinking that it should be possible
somehow, (possibly an API), seeing as Windows has the capability to
remember the previously used monitor.

I’m hoping someone can help me out, either by pointing me in the right
direction, or, telling me it’s just not possible. *Thanks in advance
for your help.

Regards,

Dave U




All times are GMT +1. The time now is 03:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com