Results 1 to 12 of 12

Thread: How to call the control panel? Find file dialog?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Unhappy

    I've tried every possible way to call the control panel

    And every way to open the find file dialog.

    Is there a way that I missed?

    I saw the API call. and the shell thing, but neither will work.

    Is there a substitute?

  2. #2
    Matthew Gates
    Guest
    To open the Control Panel:


    Code:
    Shell "C:\Windows\Control.exe", 1

    To open the find files dialog:


    Code:
    Private Declare Function ShellExecute _
    Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As _
    Long, ByVal lpOperation As String, ByVal lpFile As String, _
    ByVal lpParameters As String, ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
    
    
    Private Sub FindFiles(Optional sDirectory As String)
        ShellExecute Me.hwnd, "Find", IIf(sDirectory = "", "", _
        sDirectory), vbNullString, vbNullString, 1 
    End Sub

  3. #3
    Megatron
    Guest
    The path is optional. It could be just:
    Code:
    Shell "Control", 1

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Exclamation That's the problem!

    I've tried to run control.exe directly from the folder. But not even that would work.

    I think that I've tried the find file dialog API call too, but it didn't work either.

    Any advice?

    Is there code to find files?

    Also: I seem to have lost the location of one of my last posts.

    I think it was about compilers. and a program that would copy dos.

    I keep track of the location of my posts, so I don't have to look through all of the other

    ones. It's a good idea. Anyone know where it is?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Angry Been there, Tried that.

    I've tried all of those (Except the find file code) Any other ways that I havent tried?

    This is so annoying! None of these things work!

    Is there code that could change things like the screensaver and the background,

    and everything else?

  6. #6
    Megatron
    Guest
    These bits of code should work. Are you trying to do this on a machine that has restrications?

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Cool

    Megatron is right.
    If your doing this at work (usually) they will have a system policy.
    They will not allow you to change your wallpaper or
    do other things to customize your desktop(manditory profile).
    They like to have all desktops look the same and so no one puts up a wallpaper or
    screensaver that would offend someone.
    Last edited by RobDog888; Apr 23rd, 2001 at 11:14 AM.

  8. #8
    Megatron
    Guest
    Sometimes (but not all), you can find files that in in .CP$ and change them to .CPL to make them a valid control panal file.

  9. #9
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641
    how would I get around the restricions?

    (to change my desktop on a schoool compputer.)

    Thanks,
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  10. #10
    Megatron
    Guest
    The desktop wallpaper is stored in the following registry path: HKEY_CURRENT_USER\Control Panal\Dekstop\Wallpaper

  11. #11
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641
    so I should just change that to my background and save the setting, then press F5 on the desktop?

    Thanks,
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  12. #12
    Megatron
    Guest
    Yes.

    Here's some code that will allow you to read/write from the registry.
    VB Code:
    1. Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hkey As Long) As Long
    2. Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    3. Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hkey As Long, ByVal lpSubKey As String) As Long
    4. Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hkey As Long, ByVal lpValueName As String) As Long
    5. Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    6. Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
    7. Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    8. Public Const HKEY_CLASSES_ROOT = &H80000000
    9. Public Const HKEY_CURRENT_USER = &H80000001
    10. Public Const HKEY_LOCAL_MACHINE = &H80000002
    11. Public Const HKEY_USERS = &H80000003
    12. Public Const HKEY_PERFORMANCE_DATA = &H80000004
    13. Public Const REG_SZ = 1
    14.  
    15. Function RegQueryStringValue(ByVal hkey As Long, ByVal strValueName As String)
    16.     Dim lResult As Long
    17.     Dim lValueType As Long
    18.     Dim strBuf As String
    19.     Dim lDataBufSize As Long
    20.    
    21.     On Error GoTo 0
    22.     lResult = RegQueryValueEx(hkey, strValueName, 0&, lValueType, ByVal 0&, lDataBufSize)
    23.     If lResult = ERROR_SUCCESS Then
    24.         If lValueType = REG_SZ Then
    25.             strBuf = String(lDataBufSize, " ")
    26.             lResult = RegQueryValueEx(hkey, strValueName, 0&, 0&, ByVal strBuf, lDataBufSize)
    27.             If lResult = ERROR_SUCCESS Then
    28.                 RegQueryStringValue = StripTerminator(strBuf)
    29.             End If
    30.         End If
    31.     End If
    32. End Function
    33.  
    34. Public Function GetString(hkey As Long, strpath As String, strvalue As String)
    35.     Dim keyhand&
    36.     Dim datatype&
    37.     r = RegOpenKey(hkey, strpath, keyhand&)
    38.     GetString = RegQueryStringValue(keyhand&, strvalue)
    39.     r = RegCloseKey(keyhand&)
    40. End Function
    41.  
    42. Function StripTerminator(ByVal strString As String) As String
    43.     Dim intZeroPos As Integer
    44.  
    45.     intZeroPos = InStr(strString, Chr$(0))
    46.     If intZeroPos > 0 Then
    47.         StripTerminator = Left$(strString, intZeroPos - 1)
    48.     Else
    49.         StripTerminator = strString
    50.     End If
    51. End Function
    52.  
    53. Public Sub savestring(hkey As Long, strpath As String, strvalue As String, strdata As String)
    54.  
    55.     Dim keyhand&
    56.     r = RegCreateKey(hkey, strpath, keyhand&)
    57.     r = RegSetValueEx(keyhand&, strvalue, 0, REG_SZ, ByVal strdata, Len(strdata))
    58.     r = RegCloseKey(keyhand&)
    59.  
    60. End Sub
    61.  
    62. 'In your Form
    63. '////////////////////
    64.  
    65. Private Sub Command1_Click()
    66.     'Save a Value to the Registry
    67.     savestring HKEY_CURRENT_USER, "Software\Myapp", "Te555sting", "Hello"
    68. End Sub
    69.  
    70. Private Sub Command2_Click()
    71.     'Get a value from the Registry
    72.     Retval = GetString(HKEY_CURRENT_USER, "Software\Myapp", "Te555sting")
    73.     Print Retval
    74. End Sub

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