Simple Question I think

  • Thread starter Thread starter Karen27
  • Start date Start date
K

Karen27

Hi all,

Does anyone know of the file names (executables) that start the
following Windows dialog boxes.

Control Panel
Desktop properties
Run dialog box
Search files dialog box
Search computer dialog box
Date/Time property sheet
Shutdown windows dialog box

Thanks for any help

Karen
 
Hi Karen,

Desktop properties - desk.cpl
Date/Time property sheet - timedate.cpl
Shutdown windows dialog box - shutdown -i (will start shutdown GUI - try
going to shell and typing shutdown -? for more options - you could script
these into a batch file)

If you could let me know what you rpopose to do with these, I could probably
provide more assistance on the others.

Hope this helps

Sunil Jayakumar

Karen27 said:
Hi all,

Does anyone know of the file names (executables) that start the
following Windows dialog boxes.

Control Panel
Desktop properties
Run dialog box
Search files dialog box
Search computer dialog box
Date/Time property sheet
Shutdown windows dialog box

Thanks for any help

Karen
www.ayyoo.com/creditcards.html
 
Hi Sunil,

Thanks for your help.

You're right I'm trying to script this into a vbs or wsh file, so when
the users boot their system it will ask them if they wish to execute
them or not.

Here's a snippet of the code:

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

Response = MsgBox("Do you wish to execute the 'Desktop properties'?",
vbYesNo + vbQuestion)
If Response = vbYes Then
MsgBox "The 'Desktop properties' will now be executed", vbOKOnly +
vbInformation WshOption.Run "desk.cpl", 1
End If

Response = MsgBox("Do you wish to execute the 'Date/Time property
sheet'?", vbYesNo + vbQuestion)
If Response = vbYes Then
MsgBox "The 'Date/Time property sheet' will now be executed",
vbOKOnly + vbInformation
WshOption.Run "timedate.cpl", 1
End If

As you see above, I did try using those files you mentioned for the
desktop and the date/time, but the message I get when I try to execute
the script is: "No application is associated with the specified file".

However, when I located and double-clicked the file - they did run
those dialogs fine then - so they are indeed the correct files, it must
be my coding.

By the way the shutdown file you said works fine in the code - it just
seems to be the cpl files that don't seem to work.

Thanks again for your help Sunil

Regards
Karen
 
Hi Karen,

You can actually accomplish most of this by just passing commands into the
shell.

E.g.:

Dim x As Integer
x = Shell("Control Panel", vbNormalNoFocus)

or
x = Shell("\\server\share\batchfile.bat", vbNormalNoFocus)

Again, there are a few options for the window handling:

vbHide
Invisible new window and does not appear in the task bar - rarely used.

vbMaximizedFocus
The new window is maximised and gets focus.

vbMinimizedFocus
The new window is minimised and gets focus - this is the default.

vbMinimizedNoFocus
The new window is minimised and does not get focus.

vbNormalFocus
The new window starts normally and gets focus.

vbNormalNoFocus
The window starts at normal size but does not get focus.

The shell command is doesn't work with all of them, but you can also point
it to .bat files, which you could script and include on a server - see
above.

I don't know why the cpl applets don't work properly, because they DO work
from a command prompt. You may need to just script it into a batch file and
use

x = Shell("c:\test.bat", vbhide)

This worked fine when I had a batch file that just said "desk.cpl".

Hope this helps - I'll be watching this thread, should you require any
further assistance.

Warm regards

Sunil Jayakumar


Karen27 said:
Hi Sunil,

Thanks for your help.

You're right I'm trying to script this into a vbs or wsh file, so when
the users boot their system it will ask them if they wish to execute
them or not.

Here's a snippet of the code:

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

Response = MsgBox("Do you wish to execute the 'Desktop properties'?",
vbYesNo + vbQuestion)
If Response = vbYes Then
MsgBox "The 'Desktop properties' will now be executed", vbOKOnly +
vbInformation WshOption.Run "desk.cpl", 1
End If

Response = MsgBox("Do you wish to execute the 'Date/Time property
sheet'?", vbYesNo + vbQuestion)
If Response = vbYes Then
MsgBox "The 'Date/Time property sheet' will now be executed",
vbOKOnly + vbInformation
WshOption.Run "timedate.cpl", 1
End If

As you see above, I did try using those files you mentioned for the
desktop and the date/time, but the message I get when I try to execute
the script is: "No application is associated with the specified file".

However, when I located and double-clicked the file - they did run
those dialogs fine then - so they are indeed the correct files, it must
be my coding.

By the way the shutdown file you said works fine in the code - it just
seems to be the cpl files that don't seem to work.

Thanks again for your help Sunil

Regards
Karen

www.ayyoo.com/credit-cards.html
 
Hi Karen,

Just an afterthought - have you had any luck with the vbSendKeys function?

Best,

Sunil Jayakumar

Karen27 said:
Hi Sunil,

Thanks for your help.

You're right I'm trying to script this into a vbs or wsh file, so when
the users boot their system it will ask them if they wish to execute
them or not.

Here's a snippet of the code:

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

Response = MsgBox("Do you wish to execute the 'Desktop properties'?",
vbYesNo + vbQuestion)
If Response = vbYes Then
MsgBox "The 'Desktop properties' will now be executed", vbOKOnly +
vbInformation WshOption.Run "desk.cpl", 1
End If

Response = MsgBox("Do you wish to execute the 'Date/Time property
sheet'?", vbYesNo + vbQuestion)
If Response = vbYes Then
MsgBox "The 'Date/Time property sheet' will now be executed",
vbOKOnly + vbInformation
WshOption.Run "timedate.cpl", 1
End If

As you see above, I did try using those files you mentioned for the
desktop and the date/time, but the message I get when I try to execute
the script is: "No application is associated with the specified file".

However, when I located and double-clicked the file - they did run
those dialogs fine then - so they are indeed the correct files, it must
be my coding.

By the way the shutdown file you said works fine in the code - it just
seems to be the cpl files that don't seem to work.

Thanks again for your help Sunil

Regards
Karen

www.ayyoo.com/mortgage.html
 
Hi Sunil,

Thanks again for your help. The way I got around this was as follows.

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

The 'Control Panel'
WshOption.Run "rundll32 shell32.dll,Control_RunDLL"

The 'Desktop properties'
WshOption.Run "rundll32 shell32.dll,Control_RunDLL desk.cpl"
End If

The 'Run dialog box'
CreateObject("Shell.Application").FileRun

'Search files dialog box'
CreateObject("Shell.Application").FindFiles

The 'Search computer dialog box'
CreateObject("Shell.Application").FindComputer

The 'Date/Time property sheet'
WshOption.Run "rundll32 shell32.dll,Control_RunDLL timedate.cpl"

The 'Shutdown Windows dialog box'
CreateObject("Shell.Application").ShutDownWindows

This question was for a WSH program I'm working on, so it really wasn't
an Excel thing as such - although it could be modified slightly and
used within Excel if there was a need.

Kind regards
Karen
 
Back
Top