Results 1 to 6 of 6

Thread: Shell

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    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).]

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    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

    [email protected]
    A BMW Group Company

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    If you want to chage Time why not to do it programmatically. You will use SetSyatemTime API. It can change time and date:

    Code:
    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
    [email protected]
    [email protected]
    ICQ#: 51055819



  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    If you want to shell control panel applets you can use the following:

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

    Good luck!

    ------------------
    Joacim Andersson
    [email protected]
    [email protected]
    www.YellowBlazer.com



  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    Thanks for your replies!!!

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


  6. #6
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Post

    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: [email protected]
    ICQ: 19552879


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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width