PDA

Click to See Complete Forum and Search --> : Shell


QWERTY
Nov 4th, 1999, 10:20 AM
Does Shell Function works only for .exe files?
If yes how can I run program to set Windows Time (program that you can run by clicking clock in the lower right part of your screen or whereever your clock is). It ends with .cpl I believe.
Thanks

------------------
Visual Basic Programmer
-----------------
PolComSoft
You will hear a lot about it.

!!!!!THIS POST MADE ME A MEMBER!!!!!

[This message has been edited by QWERTY (edited 11-04-1999).]

Mark Sreeves
Nov 4th, 1999, 02:36 PM
This came from MSDN:

SUMMARY
Applications running under Windows 95, Windows 98, or Windows NT 4.0 can start a Control Panel applet by using the RUNDLL32 utility.

MORE INFORMATION
RUNDLL32 is a utility included with Windows 95, Windows 98, and Windows NT 4.0 that allows you to start a function that is exported from a DLL from a command-line. The shell uses RUNDLL32 to call the Control_RunDLL function in Shell32.dll to start a Control Panel applet. Applications can use the following command line to start a Control Panel applet:


rundll32.exe shell32.dll,Control_RunDLL mycontrol.cpl

NOTE: The command "Control_RunDLL" is case sensitive and must exactly match the case shown.
This starts the first control panel applet in Mycontrol.cpl. If you have multiple control panel applets in Mycontrol.cpl, you need to add to the following line exactly as shown:


rundll32.exe shell32.dll,Control_RunDLL mycontrol.cpl,@1

@1 specifies the second (zero-based) applet in the .cpl file. If you don't specify this parameter, @0 is used by default.
The final (optional) parameter serves as the command line parameters passed to the Control Panel applet in the CPL_STARTWPARM notification. For example, some of the system's Control Panel applets take the page number (one based, not zero based) as the command line parameter. For example, if you wan to start the Add/Remove Programs applet from the Windows Setup page so you can instruct the user to add extra system components, you can use this code:


rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,@0,2

NOTE: If you put a space after the comma in the commands above, the following error message will appear:

Error in shell32.dll
Missing entry.



------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

Serge
Nov 4th, 1999, 06:14 PM
If you want to chage Time why not to do it programmatically. You will use SetSyatemTime API. It can change time and date:


Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type


'------------Put this on any event you want
Dim strucTime As SYSTEMTIME

strucTime.wDay = Day(Date) + 2
strucTime.wHour = Hour(Time) + 2
strucTime.wMinute = Minute(Time)
Call SetSystemTime(strucTime)




Regards,

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819

Joacim Andersson
Nov 4th, 1999, 07:57 PM
If you want to shell control panel applets you can use the following:

Call Shell("Control.exe Date/Time", vbNormalFocus)

Good luck!

------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)

QWERTY
Nov 5th, 1999, 01:31 AM
Thanks for your replies!!!

------------------
Visual Basic Programmer
-----------------
PolComSoft
You will hear a lot about it.

Yonatan
Nov 5th, 1999, 02:29 AM
Serge: It works, but why use the API if it's built into VB?

Time = #10:25:30 PM# ' Set System Time
Date = #1/1/99# ' Set System Date

------------------
Yonatan
Teenage Programmer
E-Mail: RZvika@netvision.net.il
ICQ: 19552879 (http://www.icq.com/19552879)

[This message has been edited by Yonatan (edited 11-05-1999).]