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


Tema destacado: Introducción a Git (Primera Parte)


  Mostrar Mensajes
Páginas: 1 ... 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 [909] 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 ... 1253
9081  Programación / Scripting / Re: Cambiar el nombre inicial de Archivos con nombres similares en: 5 Junio 2013, 16:34 pm
Código:
@Echo OFF
Setlocal enabledelayedexpansion

Set "FileExt=PDF"
Set "Pattern=PZQR"
Set "Replace=TE"

FOR %%@ IN ("*%Pattern%*.%FileExt%") DO (
Set "File=%%@"
Ren "%%@" "!File:%Pattern%=%Replace%!"
)


Pause&Exit

Saludos
9082  Media / Multimedia / Re: ayuda para Reparar archivos de un DVD que cambio de formato a mis archivos en: 5 Junio 2013, 16:29 pm
Me parece que el problema aquí es que no has asociado los tipos de archivo a su programa correspondiente, es decir, que para abrir archivos zip no tienes instalado un programa de compresión (winzip, winrar), etc.

Aqunque si el problema es que los archivos no puedes copiarlos desde el DVD al HDD, aquí tienes un software que me ha salvado en más de una ocasión:
http://www.oemailrecovery.com/cd_recovery.html

Y este, por si acaso el primero no hiciera su trabajo corréctamente:
http://www.anyreader.com/

Saludos.

9083  Sistemas Operativos / Windows / Re: Archivo Host Modificarlo en: 5 Junio 2013, 16:24 pm
He cogido el block de notas y lo he abierto como administrador pero como el archivo esta en modo lectura no he podido modificarlo.

¿Alguna otra forma de quitar el modo lectura de ese archivo?

Click derecho sobre el archivo "hosts", y pinchas en la casilla "Solo lectura" para desactivarlo...

Código
  1. Attrib -r "hosts"

Salu2!
9084  Sistemas Operativos / Windows / Re: Línea de comandos en windows. en: 5 Junio 2013, 16:20 pm
He intentado hacer funcionar aircrack dado doble click pero se abre y a los 2 segundos se cierra.

¿quiere eso decir que debo usar la línea de comandos?

Aircrack es una suite de aplicaciones commandline, efectivamente tienes que usarlas por consola,
Te puedes descargar el AirCrack-ng GUI, que como su nombre indica es una GUI (Graphical User Interface), y ya no necesitarás usar aircrack por consola.

Saludos.
9085  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] Ocultar varios groupbox en: 4 Junio 2013, 22:04 pm
Gracias, pero, ¿no hay manera de ocultar sólo los "grpEx*" sin tener que recorrer todos los groupboxes? Es para optimizar un poco

No, hay que hacer la iteración de los controles uno por uno,
Otra forma sería que todos esos groupboxes los metieses en un nuevo panel (Dentro del panel que ya estás usando), y entonces haces un simple "NuevoPanel.visible = false"

EDITO:
Código
  1. If TypeOf Control Is GroupBox andalso Control.name.startswith("grpEx") then...

Saludos!
9086  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] Ocultar varios groupbox en: 4 Junio 2013, 21:57 pm
Te lo he hecho en VBNET, no es nada dificil convertirlo a C#:

Código
  1.    Public Sub Disable_Groupboxes(ByVal Container As ControlCollection, ByVal Visible As Boolean)
  2.        For Each Control As Control In Container
  3.            If TypeOf Control Is GroupBox Then Control.Visible = Visible
  4.        Next
  5.    End Sub

Código
  1. Disable_Groupboxes(Me.Controls, False)

http://converter.telerik.com/

Saludos!
9087  Programación / Programación General / Re: Duda sobre lenguajes en: 4 Junio 2013, 21:42 pm
No sé si me entiendes... no quiero que el lenguaje acepte que cada uno organice el código como le salga de las narices (cosa que Python no hace, sólo daba un ejemplo)

Ahora lo entiendo mejor, creia que solo estaba relacionado con los espacios de los comentarios,
pues VB.NET no permite escribir nada con espacios (ningún keyword), si escribes espacios demás te lo organiza automáticamente, séa lo que séa, menos cadenas de strings cerradas con comillas dobles (obvio) xD.

Pruébalo!

Un saludo.
9088  Programación / Programación General / Re: Duda sobre lenguajes en: 4 Junio 2013, 21:25 pm
No entiendo la lógica de la pregunta.

Python:
Código
  1. print "Hola" # Perfectamente valido...

Los lenguajes permiten líneas de comentario, ya sea encima del bloque, debajo, o al final de una línea,
De hecho unos buenos comentarios es lo que perfecciona la organización del código en si mismo.

De verdad, yo no lo véo lógica a la pregunta, o a lo mejor es que he entendido mal...

...pero desde luego si yo supiera C# hasta cierto punto, ni loco me cambiaria por un lenguaje de scripting, aunque séa Python, de hecho el que menos sería Python porque es demasiado restrictivo y para escribir códigos cortos a lo "pseudo" o para escribir 4 tonterías para probar una cosa pequeña te puedes tirar varios minutos corrigiendo ya que hay que escribirlo todo sin imperfecciones, al más mínimo detalle, sin poder equivocarse en el margen de ni un solo espacio! ...Python será organizado, pero desde luego no lo considero productivo, a la larga hace perder el tiempo.

Saludos!
9089  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 4 Junio 2013, 20:41 pm
Taskbar Hide-Show

Oculta o desoculta la barra de tareas de Windows.

Código
  1. #Region " Taskbar Hide-Show "
  2.  
  3. ' [ Taskbar Hide-Show]
  4. '
  5. ' Examples :
  6. '
  7. ' Taskbar.Hide()
  8. ' Taskbar.Show()
  9.  
  10. #End Region
  11.  
  12. ' Taskbar.vb
  13. #Region " Taskbar Class "
  14.  
  15. ''' <summary>
  16. ''' Helper class for hiding/showing the taskbar and startmenu on
  17. ''' Windows XP and Vista.
  18. ''' </summary>
  19. Public Class Taskbar
  20.  
  21.    <System.Runtime.InteropServices.DllImport("user32.dll")> _
  22.    Private Shared Function GetWindowText(hWnd As IntPtr, text As System.Text.StringBuilder, count As Integer) As Integer
  23.    End Function
  24.    <System.Runtime.InteropServices.DllImport("user32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
  25.    Private Shared Function EnumThreadWindows(threadId As Integer, pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean
  26.    End Function
  27.    <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _
  28.    Private Shared Function FindWindow(lpClassName As String, lpWindowName As String) As System.IntPtr
  29.    End Function
  30.    <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _
  31.    Private Shared Function FindWindowEx(parentHandle As IntPtr, childAfter As IntPtr, className As String, windowTitle As String) As IntPtr
  32.    End Function
  33.    <System.Runtime.InteropServices.DllImport("user32.dll")> _
  34.    Private Shared Function FindWindowEx(parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String) As IntPtr
  35.    End Function
  36.    <System.Runtime.InteropServices.DllImport("user32.dll")> _
  37.    Private Shared Function ShowWindow(hwnd As IntPtr, nCmdShow As Integer) As Integer
  38.    End Function
  39.    <System.Runtime.InteropServices.DllImport("user32.dll")> _
  40.    Private Shared Function GetWindowThreadProcessId(hwnd As IntPtr, lpdwProcessId As Integer) As UInteger
  41.    End Function
  42.  
  43.    Private Const SW_HIDE As Integer = 0
  44.    Private Const SW_SHOW As Integer = 5
  45.  
  46.    Private Const VistaStartMenuCaption As String = "Start"
  47.    Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero
  48.    Private Delegate Function EnumThreadProc(hwnd As IntPtr, lParam As IntPtr) As Boolean
  49.  
  50.    ''' <summary>
  51.    ''' Show the taskbar.
  52.    ''' </summary>
  53.    Public Shared Sub Show()
  54.        SetVisibility(True)
  55.    End Sub
  56.  
  57.    ''' <summary>
  58.    ''' Hide the taskbar.
  59.    ''' </summary>
  60.    Public Shared Sub Hide()
  61.        SetVisibility(False)
  62.    End Sub
  63.  
  64.    ''' <summary>
  65.    ''' Sets the visibility of the taskbar.
  66.    ''' </summary>
  67.    Private Shared WriteOnly Property Visible() As Boolean
  68.        Set(value As Boolean)
  69.            SetVisibility(value)
  70.        End Set
  71.    End Property
  72.  
  73.    ''' <summary>
  74.    ''' Hide or show the Windows taskbar and startmenu.
  75.    ''' </summary>
  76.    ''' <param name="show">true to show, false to hide</param>
  77.    Private Shared Sub SetVisibility(show As Boolean)
  78.        ' get taskbar window
  79.        Dim taskBarWnd As IntPtr = FindWindow("Shell_TrayWnd", Nothing)
  80.  
  81.        ' Try the Windows XP TaskBar:
  82.        Dim startWnd As IntPtr = FindWindowEx(taskBarWnd, IntPtr.Zero, "Button", "Start")
  83.  
  84.        If startWnd = IntPtr.Zero Then
  85.            ' Try an alternate way of Windows XP TaskBar:
  86.            startWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, CType(&HC017, IntPtr), "Start")
  87.        End If
  88.  
  89.        If startWnd = IntPtr.Zero Then
  90.            ' Try the Windows Vista/7 TaskBar:
  91.            startWnd = FindWindow("Button", Nothing)
  92.  
  93.            If startWnd = IntPtr.Zero Then
  94.                ' Try an alternate way of Windows Vista/7 TaskBar:
  95.                startWnd = GetVistaStartMenuWnd(taskBarWnd)
  96.            End If
  97.        End If
  98.  
  99.        ShowWindow(taskBarWnd, If(show, SW_SHOW, SW_HIDE))
  100.        ShowWindow(startWnd, If(show, SW_SHOW, SW_HIDE))
  101.  
  102.    End Sub
  103.  
  104.    ''' <summary>
  105.    ''' Returns the window handle of the Vista start menu orb.
  106.    ''' </summary>
  107.    ''' <param name="taskBarWnd">windo handle of taskbar</param>
  108.    ''' <returns>window handle of start menu</returns>
  109.    Private Shared Function GetVistaStartMenuWnd(taskBarWnd As IntPtr) As IntPtr
  110.        ' get process that owns the taskbar window
  111.        Dim procId As Integer
  112.        GetWindowThreadProcessId(taskBarWnd, procId)
  113.  
  114.        Dim p As Process = Process.GetProcessById(procId)
  115.        If p IsNot Nothing Then
  116.            ' enumerate all threads of that process...
  117.            For Each t As ProcessThread In p.Threads
  118.                EnumThreadWindows(t.Id, AddressOf MyEnumThreadWindowsProc, IntPtr.Zero)
  119.            Next
  120.        End If
  121.        Return vistaStartMenuWnd
  122.    End Function
  123.  
  124.    ''' <summary>
  125.    ''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'.
  126.    ''' </summary>
  127.    ''' <param name="hWnd">window handle</param>
  128.    ''' <param name="lParam">parameter</param>
  129.    ''' <returns>true to continue enumeration, false to stop it</returns>
  130.    Private Shared Function MyEnumThreadWindowsProc(hWnd As IntPtr, lParam As IntPtr) As Boolean
  131.        Dim buffer As New System.Text.StringBuilder(256)
  132.        If GetWindowText(hWnd, buffer, buffer.Capacity) > 0 Then
  133.            Console.WriteLine(buffer)
  134.            If buffer.ToString() = VistaStartMenuCaption Then
  135.                vistaStartMenuWnd = hWnd
  136.                Return False
  137.            End If
  138.        End If
  139.        Return True
  140.    End Function
  141.  
  142. End Class
  143.  
  144. #End Region
9090  Programación / .NET (C#, VB.NET, ASP) / Re: Ayuda para traducir una función anónima de C# a VBNET en: 4 Junio 2013, 20:13 pm
Bueno, aquí les dejo el código convertido a vbnet, ya lo conseguí:

Código
  1. Imports System
  2. Imports System.Text
  3. Imports System.Runtime.InteropServices
  4. Imports System.Diagnostics
  5.  
  6. Namespace TaskbarHide
  7.    ''' <summary>
  8.    ''' Helper class for hiding/showing the taskbar and startmenu on
  9.    ''' Windows XP and Vista.
  10.    ''' </summary>
  11.    Public NotInheritable Class Taskbar
  12.        Private Sub New()
  13.        End Sub
  14.        <DllImport("user32.dll")> _
  15.        Private Shared Function GetWindowText(hWnd As IntPtr, text As StringBuilder, count As Integer) As Integer
  16.        End Function
  17.        <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
  18.        Private Shared Function EnumThreadWindows(threadId As Integer, pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean
  19.        End Function
  20.        <DllImport("user32.dll", SetLastError:=True)> _
  21.        Private Shared Function FindWindow(lpClassName As String, lpWindowName As String) As System.IntPtr
  22.        End Function
  23.        <DllImport("user32.dll", SetLastError:=True)> _
  24.        Private Shared Function FindWindowEx(parentHandle As IntPtr, childAfter As IntPtr, className As String, windowTitle As String) As IntPtr
  25.        End Function
  26.        <DllImport("user32.dll")> _
  27.        Private Shared Function FindWindowEx(parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String) As IntPtr
  28.        End Function
  29.        <DllImport("user32.dll")> _
  30.        Private Shared Function ShowWindow(hwnd As IntPtr, nCmdShow As Integer) As Integer
  31.        End Function
  32.        <DllImport("user32.dll")> _
  33.        Private Shared Function GetWindowThreadProcessId(hwnd As IntPtr, lpdwProcessId As Integer) As UInteger
  34.        End Function
  35.  
  36.        Private Const SW_HIDE As Integer = 0
  37.        Private Const SW_SHOW As Integer = 5
  38.  
  39.        Private Const VistaStartMenuCaption As String = "Start"
  40.        Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero
  41.        Private Delegate Function EnumThreadProc(hwnd As IntPtr, lParam As IntPtr) As Boolean
  42.  
  43.        ''' <summary>
  44.        ''' Show the taskbar.
  45.        ''' </summary>
  46.        Public Shared Sub Show()
  47.            SetVisibility(True)
  48.        End Sub
  49.  
  50.        ''' <summary>
  51.        ''' Hide the taskbar.
  52.        ''' </summary>
  53.        Public Shared Sub Hide()
  54.            SetVisibility(False)
  55.        End Sub
  56.  
  57.        ''' <summary>
  58.        ''' Sets the visibility of the taskbar.
  59.        ''' </summary>
  60.        Public Shared WriteOnly Property Visible() As Boolean
  61.            Set(value As Boolean)
  62.                SetVisibility(value)
  63.            End Set
  64.        End Property
  65.  
  66.        ''' <summary>
  67.        ''' Hide or show the Windows taskbar and startmenu.
  68.        ''' </summary>
  69.        ''' <param name="show">true to show, false to hide</param>
  70.        Private Shared Sub SetVisibility(show As Boolean)
  71.            ' get taskbar window
  72.            Dim taskBarWnd As IntPtr = FindWindow("Shell_TrayWnd", Nothing)
  73.  
  74.            ' try it the WinXP way first...
  75.            Dim startWnd As IntPtr = FindWindowEx(taskBarWnd, IntPtr.Zero, "Button", "Start")
  76.  
  77.            If startWnd = IntPtr.Zero Then
  78.                ' try an alternate way, as mentioned on CodeProject by Earl Waylon Flinn
  79.                startWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, CType(&HC017, IntPtr), "Start")
  80.            End If
  81.  
  82.            If startWnd = IntPtr.Zero Then
  83.                ' ok, let's try the Vista easy way...
  84.                startWnd = FindWindow("Button", Nothing)
  85.  
  86.                If startWnd = IntPtr.Zero Then
  87.                    ' no chance, we need to to it the hard way...
  88.                    startWnd = GetVistaStartMenuWnd(taskBarWnd)
  89.                End If
  90.            End If
  91.  
  92.            ShowWindow(taskBarWnd, If(show, SW_SHOW, SW_HIDE))
  93.            ShowWindow(startWnd, If(show, SW_SHOW, SW_HIDE))
  94.        End Sub
  95.  
  96.        ''' <summary>
  97.        ''' Returns the window handle of the Vista start menu orb.
  98.        ''' </summary>
  99.        ''' <param name="taskBarWnd">windo handle of taskbar</param>
  100.        ''' <returns>window handle of start menu</returns>
  101.        Private Shared Function GetVistaStartMenuWnd(taskBarWnd As IntPtr) As IntPtr
  102.            ' get process that owns the taskbar window
  103.            Dim procId As Integer
  104.            GetWindowThreadProcessId(taskBarWnd, procId)
  105.  
  106.            Dim p As Process = Process.GetProcessById(procId)
  107.            If p IsNot Nothing Then
  108.                ' enumerate all threads of that process...
  109.                For Each t As ProcessThread In p.Threads
  110.                    EnumThreadWindows(t.Id, AddressOf MyEnumThreadWindowsProc, IntPtr.Zero)
  111.                Next
  112.            End If
  113.            Return vistaStartMenuWnd
  114.        End Function
  115.  
  116.        ''' <summary>
  117.        ''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'.
  118.        ''' </summary>
  119.        ''' <param name="hWnd">window handle</param>
  120.        ''' <param name="lParam">parameter</param>
  121.        ''' <returns>true to continue enumeration, false to stop it</returns>
  122.        Private Shared Function MyEnumThreadWindowsProc(hWnd As IntPtr, lParam As IntPtr) As Boolean
  123.            Dim buffer As New StringBuilder(256)
  124.            If GetWindowText(hWnd, buffer, buffer.Capacity) > 0 Then
  125.                Console.WriteLine(buffer)
  126.                If buffer.ToString() = VistaStartMenuCaption Then
  127.                    vistaStartMenuWnd = hWnd
  128.                    Return False
  129.                End If
  130.            End If
  131.            Return True
  132.        End Function
  133.    End Class
  134. End Namespace
Páginas: 1 ... 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 [909] 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 ... 1253
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines