elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Show_Hide_Desktop
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Show_Hide_Desktop  (Leído 1,639 veces)
h0oke


Desconectado Desconectado

Mensajes: 2.059


Coder ~


Ver Perfil WWW
Show_Hide_Desktop
« en: 14 Junio 2009, 19:39 pm »

Hola hace unas 2 horas se me dio la idea de hacer un programita para ocultar y mostrar el escritorio.

A algunos seguro les será bienvenido a otros no, pero es sólo para compartir experiencia.

Código
  1. Option Explicit
  2. Private Declare Function SetErrorMode Lib "kernel32" (ByVal wMode As Long) As Long
  3. Private Declare Sub InitCommonControls Lib "Comctl32" ()
  4. Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
  5. Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
  6. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _
  7.    ByVal hWnd1 As Long, _
  8.    ByVal hWnd2 As Long, _
  9.    ByVal lpsz1 As String, _
  10.    ByVal lpsz2 As String) As Long
  11. Private Declare Function ShowWindow Lib "user32" ( _
  12. ByVal hwnd As Long, _
  13. ByVal nCmdShow As Long) As Long
  14. Private Const SW_SHOW = 5
  15. Private Const SW_HIDE = 0
  16. Private Const NIM_ADD = &H0
  17. Private Const NIM_MODIFY = &H1
  18. Private Const NIM_DELETE = &H2
  19. Private Const NIF_MESSAGE = &H1
  20. Private Const NIF_ICON = &H2
  21. Private Const NIF_TIP = &H4
  22. Private Const WM_LBUTTONDBLCLK = &H203
  23. Private Const WM_LBUTTONDOWN = &H201
  24. Private Const WM_RBUTTONUP = &H205
  25. Private Const KEY_TOGGLED As Integer = &H1
  26. Private Const KEY_PRESSED As Integer = &H1000
  27. Private Type NOTIFYICONDATA
  28.    cbSize As Long
  29.    hwnd As Long
  30.    uId As Long
  31.    uFlags As Long
  32.    ucallbackMessage As Long
  33.    hIcon As Long
  34.    szTip As String * 64
  35. End Type
  36. Dim sysTray As NOTIFYICONDATA
  37.  
  38. Private Sub Command1_Click()
  39.    MsgBox " Hacer Doble click en el ícono para reestaurar el Form", vbInformation, "SH_DEKTOP"
  40.    Call Colocar_Tray(1000)
  41. End Sub
  42.  
  43. Private Sub Command2_Click()
  44.    Call Quitar_Systray
  45. End Sub
  46. Sub Colocar_Tray(Intervalo As Integer)
  47.     With sysTray
  48.        .cbSize = Len(sysTray)
  49.        .hwnd = Me.hwnd
  50.        .uId = 1&
  51.         .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
  52.        .ucallbackMessage = WM_LBUTTONDOWN
  53.        .hIcon = Image1.Picture
  54.    End With
  55.  
  56.    Call Shell_NotifyIcon(NIM_ADD, sysTray)
  57.  
  58.    Me.Hide
  59.    Timer1.Interval = Intervalo
  60. End Sub
  61. Sub Quitar_Systray()
  62.    With sysTray
  63.        .cbSize = Len(sysTray)
  64.        .hwnd = Me.hwnd
  65.        .uId = 1&
  66.    End With
  67.    Call Shell_NotifyIcon(NIM_DELETE, sysTray)
  68. End Sub
  69.  
  70. Private Sub Command3_Click()
  71. End
  72. End Sub
  73.  
  74. Private Sub Form_Initialize()
  75.    Call SetErrorMode(2)
  76.    Call InitCommonControls
  77.    Me.Caption = "SH_DEKTOP"
  78. End Sub
  79.  
  80. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  81.    Dim msg
  82.    msg = X / Screen.TwipsPerPixelX
  83.    If msg = WM_LBUTTONDBLCLK Then
  84.        mnuMostrar_Click
  85.    ElseIf msg = WM_RBUTTONUP Then
  86.        Me.PopupMenu mnuPopup
  87.    End If
  88. End Sub
  89.  
  90. Private Sub mnuMostrar_Click()
  91.    Timer1.Interval = 0
  92.    Me.Show
  93. End Sub
  94.  
  95. Private Sub mnuSalir_Click()
  96.    Unload Me
  97. End Sub
  98. Private Sub Timer1_Timer()
  99.    sysTray.hIcon = Image1.Picture
  100.    Call Shell_NotifyIcon(NIM_MODIFY, sysTray)
  101. End Sub
  102. Private Sub Form_Load()
  103.    Image1.Visible = False
  104.    Command1.Caption = " Colocar en el systray "
  105.    Command2.Caption = " Quitar del sysTray "
  106.    Command3.Caption = "Salir"
  107.    Timer2.Enabled = True
  108.    Timer2.Interval = 100
  109. End Sub
  110.  
  111. Private Sub Form_Unload(Cancel As Integer)
  112.    Quitar_Systray
  113.    End
  114. End Sub
  115.  
  116. Private Sub Timer2_Timer()
  117. If GetKeyState(vbKeyF10) And KEY_PRESSED Then
  118.    Dim HWND_Escritorio As Long
  119.    On Error Resume Next
  120.    HWND_Escritorio = FindWindowEx(0&, 0&, "Progman", vbNullString)
  121.    Call ShowWindow(HWND_Escritorio, SW_HIDE)
  122. ElseIf GetKeyState(vbKeyF11) And KEY_PRESSED Then
  123.    On Error Resume Next
  124.    HWND_Escritorio = FindWindowEx(0&, 0&, "Progman", vbNullString)
  125.    Call ShowWindow(HWND_Escritorio, SW_SHOW)
  126. End If
  127. End Sub




En línea

h0oke


Desconectado Desconectado

Mensajes: 2.059


Coder ~


Ver Perfil WWW
Re: Show_Hide_Desktop
« Respuesta #1 en: 17 Junio 2009, 03:22 am »

Seba mencionó también el uso de RegistrerHotKey unRegistrerHotKey para no hacer uso del timer. Alguno tiene un ejemplo simple? Yo le he intentado pero no me detecta las teclas.


En línea

kisk

Desconectado Desconectado

Mensajes: 55



Ver Perfil
Re: Show_Hide_Desktop
« Respuesta #2 en: 17 Junio 2009, 15:10 pm »

Se ve bn luego te tenga tiempo le echo un ojo gracias
saludos
En línea

La vieja escuela me da nostalgia la nueva me da naucias dime cual es la escuela si ambas me deprimen (8)
seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: Show_Hide_Desktop
« Respuesta #3 en: 18 Junio 2009, 03:27 am »

Seba mencionó también el uso de RegistrerHotKey unRegistrerHotKey para no hacer uso del timer. Alguno tiene un ejemplo simple? Yo le he intentado pero no me detecta las teclas.

chequea este post que ya habia puesto un codigo basico de esas api's...tambien sirve para combinaciones...

Borrador de autorun.inf xD Copia del programa de carlitos.dll

saludos.

En línea

h0oke


Desconectado Desconectado

Mensajes: 2.059


Coder ~


Ver Perfil WWW
Re: Show_Hide_Desktop
« Respuesta #4 en: 19 Junio 2009, 03:02 am »

Seba mencionó también el uso de RegistrerHotKey unRegistrerHotKey para no hacer uso del timer. Alguno tiene un ejemplo simple? Yo le he intentado pero no me detecta las teclas.

chequea este post que ya habia puesto un codigo basico de esas api's...tambien sirve para combinaciones...

Borrador de autorun.inf xD Copia del programa de carlitos.dll

saludos.



Muchas gracias seba ahora lo estaré chekando.
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines