|
241
|
Programación / Programación Visual Basic / Re: desactivar y activar el autorun de un pen drive
|
en: 19 Junio 2009, 12:14 pm
|
Probá así, por lo menos a mí en XP-SP3 y W7 me funciona bien Option Explicit 'Private Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const HWND_BROADCAST = &HFFFF: Private Const WM_SETTINGCHANGE = &H1A
Private Sub Form_Load()
Command1.Caption = "Autorun si" Command2.Caption = "Autorun no"
End Sub
Private Sub Command1_Click() Dim WshShell As Object Set WshShell = CreateObject("WScript.Shell") WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun", 145, "REG_DWORD" Set WshShell = Nothing Call SendNotifyMessage(&HFFFF, &H1A, 0, ByVal 0)
End Sub
Private Sub Command2_Click() Dim WshShell As Object Set WshShell = CreateObject("WScript.Shell") WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun", 181, "REG_DWORD" Set WshShell = Nothing Call SendNotifyMessage(&HFFFF, &H1A, 0, ByVal 0)
End Sub
S2
|
|
|
242
|
Programación / Programación Visual Basic / Re: Problema con el administrador de tareas y regedit
|
en: 18 Junio 2009, 20:42 pm
|
Dim WshShell As Object Set WshShell = CreateObject("WScript.Shell") WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools", 0, "REG_DWORD" WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskmgr", 0, "REG_DWORD" Set WshShell = Nothing
Sumo el del registro al que te indica ssccaann43 S2
|
|
|
248
|
Programación / Programación Visual Basic / Re: desactivar y activar el autorun de un pen drive
|
en: 17 Junio 2009, 00:38 am
|
Creo que lo que quiere fabricio es que su aplicacion lo haga automaticamente, se puede hacer agregando la clave HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun" que con el dato REG_DWORD 145 permite el autorun y con el dato REG_DWORD 181 no lo permite. La parte mala es que hay que reiniciar la cpu para que tenga efecto... o sino podes matar el explorer y volverlo a ejecutar, pero eso se nota bastante.
Saludos
|
|
|
250
|
Programación / Programación Visual Basic / Re: Ayuda con AppActivate
|
en: 15 Junio 2009, 18:45 pm
|
No entendí bien la pregunta pero si es para una aplicacion tuya podes usar la propiedad WindowState del formulario, y si es para una externa podes usar IsIconic Option Explicit Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
If FindWindow("notepad", vbNullString) = 0 Then MsgBox "Notepad cerrado" Shell "notepad", vbNormalFocus Else If IsIconic(FindWindow("notepad", vbNullString)) = 0 Then MsgBox "Notepad no esta minimizado" 'Call SetForegroundWindow(FindWindow("notepad", vbNullString)) Else MsgBox "Notepad minimizado" 'Call ShowWindow(FindWindow("notepad", vbNullString), SW_SHOWNORMAL) 'Call SetForegroundWindow(FindWindow("notepad", vbNullString)) End If End If
End Sub
S2
|
|
|
|
|
|
|