Setting Extend my windows desktop onto this monitor without the GU

G

Guest

Hello, I hope someone can help. I've got 6 locked down and isolated
environments of 150+ machines (XP Pro) furthest away is 24hrs. The users
don't have access to the display settings through right clicking on the
desktop or through the control panel. We have dual monitors connected to an
ATI x1300 PCIe card and using the "Extend my windows desktop onto this
monitor".

Every once in a while we receive a call saying the second monitor is no
longer extended (normally cloning instead). Currently to fix this issue they
call and I give a trusted user an account that has the appropriate
permissions and then walk them through setting the Extend my desktop setting
back and from there it works fine. I'm looking to automate this step
hopefully as simply as possible.

Using a simply batch file I can open the Display settings panel using
"%systemroot%\system32\control.exe desk.cpl,@0,3" however they still have to
know to click on the second monitor and to select "Extend my desktop...". So
ideally I'm looking for something that the users can click on without a GUI
or other questions/interactions.

Any suggestions would be helpful. Thanks in advance.
 
G

Guest

My idea for how you could do it depends on your ability to control your
users, and their environment. A script can use a 'sendkeys()' function to do
things like 'tab' or 'spacebar' (for select) and so on. The problems arise
when the system it is running on has something active that grabs the focus
away, to spend the sent keys on something (potentially harmful, in the worst
case scenario).
Admittedly, there might be a more advanced expert available here, who might
know the registry settings to do this. I, however, am not that guy :)

Consider this psudocode example:
--somescript.vbs--
<open the control panel to display-settings tab>
<send the keys to 'tab, tab,right arrow, right arrow,tab,tab,tab, space,
enter' or whatever>
--endfile---
I successfully use this to change my rez as I wish. If you are interested in
seeing a complete file to do what you need, figure out the key presses that
the settings tab might need to do as you wish, and post back. I will write a
test file to see if it does your job. (It's possible the environment of your
various users might be so varied that some one standard script of sendkeys()
might be a nightmare to create)
 
G

Guest

Mark L. Ferguson said:
My idea for how you could do it depends on your ability to control your
users, and their environment. A script can use a 'sendkeys()' function to do
things like 'tab' or 'spacebar' (for select) and so on. The problems arise
when the system it is running on has something active that grabs the focus
away, to spend the sent keys on something (potentially harmful, in the worst
case scenario).
Admittedly, there might be a more advanced expert available here, who might
know the registry settings to do this. I, however, am not that guy :)

Consider this psudocode example:
--somescript.vbs--
<open the control panel to display-settings tab>
<send the keys to 'tab, tab,right arrow, right arrow,tab,tab,tab, space,
enter' or whatever>
--endfile---
I successfully use this to change my rez as I wish. If you are interested in
seeing a complete file to do what you need, figure out the key presses that
the settings tab might need to do as you wish, and post back. I will write a
test file to see if it does your job. (It's possible the environment of your
various users might be so varied that some one standard script of sendkeys()
might be a nightmare to create)
 
G

Guest

Thank you for responding so quickly. I've adapted a script I found using the
sendKeys() that you mentioned.

' XP Extend Windows
' Version: 1.0
' Released: Apr 23, 2007

Option Explicit
Dim WshShell, Dummy, Splash

On Error Resume Next

Set WshShell = WScript.CreateObject("WScript.Shell")

'Main
Call SplashScreen
Call DoIt
WScript.Quit

Sub SplashScreen

Splash = "Created for OPP " & vbCrLf &_
"by CAD Tech" & vbCrLf &_
"Note: Select display 2" & vbCrLf &_
" Select checkbox Extend my desktop"

Dummy = WshShell.Popup(Splash, 2, "XP Extend Desktop", 64)

End Sub 'SplashScreen

Sub DoIt
Dummy = MsgBox("Click OK to Set the Extend Desktop...", 1, "XP Nag Disabler")
If Dummy = vbOK Then
wshshell.Run("%systemroot%\system32\control.exe desk.cpl,@0,3")

' Give Display Properties time to load
WScript.Sleep 1000
WshShell.SendKeys "%2"
WshShell.SendKeys "%E"
WScript.Sleep 500
WshShell.SendKeys "%A"
WshShell.SendKeys "+{TAB}"
End If
End Sub 'DoIt

==============

I'll test this out and let you know.
 
G

Guest

Thanks the VB script will work as it will re-enable the extend desktop
setting on demand. Unfortunatly it uses the gui but no interaction from the
user is needed.

FYI: I was able to get the extend desktop to turn off but not turn back on
using the registry keys. I did a search and found 11 instances (found only 4
of the 11 with the key set to 1) of the ATTACH.TODesktop registry key.
example:
HKLM\SYSTEM\ControlSet001\Hardware
Profiles\0001\System\CurrentControlSet\Control\VIDEO\{C3BFE9BD-.....}\0000
and then under \Mon10000080

--vbscript-------
Option Explicit
Dim WshShell, Dummy, Splash

On Error Resume Next

Set WshShell = WScript.CreateObject("WScript.Shell")

'Main
Call DoIt
WScript.Quit

Sub DoIt
wshshell.Run("%systemroot%\system32\control.exe desk.cpl,@0,3")

' Give Display Properties time to load
WScript.Sleep 1000
WshShell.SendKeys "2"
WScript.Sleep 10
WshShell.SendKeys "%E"
WScript.Sleep 500
WshShell.SendKeys "%A"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
End Sub 'DoIt
-------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top