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?
Printable View
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?
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
The path is optional. It could be just:
Code:Shell "Control", 1
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?
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?
These bits of code should work. Are you trying to do this on a machine that has restrications?
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. :(
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.
how would I get around the restricions?
(to change my desktop on a schoool compputer.) :rolleyes:
Thanks, :)
The desktop wallpaper is stored in the following registry path: HKEY_CURRENT_USER\Control Panal\Dekstop\Wallpaper
so I should just change that to my background and save the setting, then press F5 on the desktop?
Thanks, :)
Yes.
Here's some code that will allow you to read/write from the registry.
VB Code:
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hkey As Long) As Long Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hkey As Long, ByVal lpSubKey As String) As Long Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hkey As Long, ByVal lpValueName As String) As Long Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 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 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 Public Const HKEY_CLASSES_ROOT = &H80000000 Public Const HKEY_CURRENT_USER = &H80000001 Public Const HKEY_LOCAL_MACHINE = &H80000002 Public Const HKEY_USERS = &H80000003 Public Const HKEY_PERFORMANCE_DATA = &H80000004 Public Const REG_SZ = 1 Function RegQueryStringValue(ByVal hkey As Long, ByVal strValueName As String) Dim lResult As Long Dim lValueType As Long Dim strBuf As String Dim lDataBufSize As Long On Error GoTo 0 lResult = RegQueryValueEx(hkey, strValueName, 0&, lValueType, ByVal 0&, lDataBufSize) If lResult = ERROR_SUCCESS Then If lValueType = REG_SZ Then strBuf = String(lDataBufSize, " ") lResult = RegQueryValueEx(hkey, strValueName, 0&, 0&, ByVal strBuf, lDataBufSize) If lResult = ERROR_SUCCESS Then RegQueryStringValue = StripTerminator(strBuf) End If End If End If End Function Public Function GetString(hkey As Long, strpath As String, strvalue As String) Dim keyhand& Dim datatype& r = RegOpenKey(hkey, strpath, keyhand&) GetString = RegQueryStringValue(keyhand&, strvalue) r = RegCloseKey(keyhand&) End Function Function StripTerminator(ByVal strString As String) As String Dim intZeroPos As Integer intZeroPos = InStr(strString, Chr$(0)) If intZeroPos > 0 Then StripTerminator = Left$(strString, intZeroPos - 1) Else StripTerminator = strString End If End Function Public Sub savestring(hkey As Long, strpath As String, strvalue As String, strdata As String) Dim keyhand& r = RegCreateKey(hkey, strpath, keyhand&) r = RegSetValueEx(keyhand&, strvalue, 0, REG_SZ, ByVal strdata, Len(strdata)) r = RegCloseKey(keyhand&) End Sub 'In your Form '//////////////////// Private Sub Command1_Click() 'Save a Value to the Registry savestring HKEY_CURRENT_USER, "Software\Myapp", "Te555sting", "Hello" End Sub Private Sub Command2_Click() 'Get a value from the Registry Retval = GetString(HKEY_CURRENT_USER, "Software\Myapp", "Te555sting") Print Retval End Sub