Results 1 to 7 of 7

Thread: Automation?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    8

    Automation?

    Hi, I am trying to see if there is a way to use automation to get the object of the Control Panel so that I can change Regional/Language settings within my programm (assign this action to a button).

    As word and excel allow programmers to have Application isntances, is there a COntrol panel isntance or Explorer instance?


    Thanks. Appreicate any comments or suggestions.

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Control panel modules are not COM, so they do not automate.

    They have the extension .cpl

    You call rundll32 to activate them (shell)

    Code:
    command:  rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,0 
    result:  displays the Regional Settings property page 
          
    command:  rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1 
    result:  displays the Numbers property page 
          
    command:  rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,2 
    result:  displays the Currency property page 
          
    command:  rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,3 
    result:  displays the Time property page 
          
    command:  rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,4 
    result:  displays the Date property page 
          
    command:  rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5 
    result:  displays the Locales property page (NT only)

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    8
    Thank you, jim. Although this is a VERY useful piece of code, this gives me no options to change withing the Regional Settings. I would want to change the settings inside the REGional Settings (RS) and possible run this in the background so that user have no idea about the actual process.

    As you mentioned the Control Panel are not COM objects, however as I understand the control panel Applets are something like a DLL packet ito a *.cpl extension. I am thinking if I can call the functions within this cpl file, but i cant find a way.

    Actually another thing : Can I use Shell Instance to try and get some properties changed this way (still talking about RG settings), you can see I am not very intimate with Win32 API at this point.

    Please let me know if you have any ideas. Appreciate your help.

  4. #4
    Lively Member
    Join Date
    Sep 2002
    Posts
    103
    There is an application called Kira which I downloaded from Planet-Source-Code once, which did a lot of system setting changes. That might do the trick for you.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    8
    Thanks Aidan I like the program, but unfortunately its does not have anything on regional settings.

  6. #6
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Randy Birch has some stuff on setting dates and some other locale information using SetLocaleInfo

    http://www.mvps.org/vbnet/code/locale/setlocaleinfo.htm

    You know it would help if you told us exactly what you are trying to set, because the api functions for a given control panel are really a bunch of different things -

    Registry settings, mostly
    codepage setting for the keyboard
    Date & time formats
    Number formats
    etc.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    8
    Thanks jim
    I am trying to change EVERYTHing (date format, time, language ane etc). So for example if your language is English I want to set it to say French. I Have found functions like setThreadLocale (win32 API) but I am having difficulty calling them through VB with the right Parameters and everythig.

    REason : I want to run a program with one language setting and then change languge and run it in another lang setting

    <code>
    Private Declare Function SetThreadLocale Lib "kernel32" _
    (ByVal LCID As Long) As Boolean

    Dim LS As Boolean
    LS = SetThreadLocale (MakeLCID(MakeLangID (0419,Sublang_Neutral), Sort_DEfault)
    </code>

    For some reason the MAkeLangID is not recognized. I am thinking its an API C++ call and not VB.

    UDDATE : THANKS FOR THE LINK.
    Last edited by margant; Jun 20th, 2003 at 09:33 AM.

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