Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Dessa

#241
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


  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
#243
Private Const HWND_BROADCAST = &HFFFF

HWND_BROADCAST te va a servir de hwnd para que el mensaje llegue.

mensaje:
Private Const WM_SETTINGCHANGE = &H1A









#244
Buena Fabricio  ;) ,  busca como usar "SendNotifyMessage" y te evitas de matar el explorer, hacés lo mismo y no se nota el parpadeo de cerrar el explorer.

Saludos


PD: Buen dato Seba
#245
Cita de: seba123neo en 18 Junio 2009, 03:20 AM
Hola, alguien vio la api SendMessageTimeout??, parece que con esa se puede refrescar el registro...

;-)


EDIT: Tambien "SendNotifyMessage" y "RefreshPolicyEx"

#246


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



Para activar el mismo code pero con 145
Tenes que matar el explorer y volcerlo a ejecutar

Saludos

#247
Text1 = Replace(Text1, Chr(10), vbNewLine)
o
Text1 = Replace(Text1, Chr(10), "")
o
cadena= Replace(cadena, Chr(10), "")



S2
#248
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


#249
Cita de: byway en 16 Junio 2009, 03:40 AM
es la misma aplicacion pero para una nueva instancia, pero para que no se ejecute y en lugar de eso maximize la actual... algo asi como para que no se ejecute el mismo exe varias veces .. se suele usar el App.PrevInstance o algo mejor la funcion API CreateMutex por si le cambian el nombre al exe.

Ahora si, si buscas en el foro creo que hay un code alternativo de Karcrack.

S2


EDIT:
http://foro.elhacker.net/programacion_vb/srcmaltmutexbas_alternativa_a_createmutex-t243771.0.html;msg1171506;topicseen

S2
#250
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