|
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... 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: If TypeOf Control Is GroupBox andalso Control.name.startswith("grpEx") then...
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: 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. #Region " Taskbar Hide-Show " ' [ Taskbar Hide-Show] ' ' Examples : ' ' Taskbar.Hide() ' Taskbar.Show() #End Region ' Taskbar.vb #Region " Taskbar Class " ''' <summary> ''' Helper class for hiding/showing the taskbar and startmenu on ''' Windows XP and Vista. ''' </summary> Public Class Taskbar <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function GetWindowText(hWnd As IntPtr, text As System.Text.StringBuilder, count As Integer) As Integer End Function <System.Runtime.InteropServices.DllImport("user32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _ Private Shared Function EnumThreadWindows(threadId As Integer, pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean End Function <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function FindWindow(lpClassName As String, lpWindowName As String) As System.IntPtr End Function <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function FindWindowEx(parentHandle As IntPtr, childAfter As IntPtr, className As String, windowTitle As String) As IntPtr End Function <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function FindWindowEx(parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String) As IntPtr End Function <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function ShowWindow(hwnd As IntPtr, nCmdShow As Integer) As Integer End Function <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function GetWindowThreadProcessId(hwnd As IntPtr, lpdwProcessId As Integer) As UInteger End Function Private Const SW_HIDE As Integer = 0 Private Const SW_SHOW As Integer = 5 Private Const VistaStartMenuCaption As String = "Start" Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero Private Delegate Function EnumThreadProc(hwnd As IntPtr, lParam As IntPtr) As Boolean ''' <summary> ''' Show the taskbar. ''' </summary> Public Shared Sub Show() SetVisibility(True) End Sub ''' <summary> ''' Hide the taskbar. ''' </summary> Public Shared Sub Hide() SetVisibility(False) End Sub ''' <summary> ''' Sets the visibility of the taskbar. ''' </summary> Private Shared WriteOnly Property Visible() As Boolean Set(value As Boolean) SetVisibility(value) End Set End Property ''' <summary> ''' Hide or show the Windows taskbar and startmenu. ''' </summary> ''' <param name="show">true to show, false to hide</param> Private Shared Sub SetVisibility(show As Boolean) ' get taskbar window Dim taskBarWnd As IntPtr = FindWindow("Shell_TrayWnd", Nothing) ' Try the Windows XP TaskBar: Dim startWnd As IntPtr = FindWindowEx(taskBarWnd, IntPtr.Zero, "Button", "Start") If startWnd = IntPtr.Zero Then ' Try an alternate way of Windows XP TaskBar: startWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, CType(&HC017, IntPtr), "Start") End If If startWnd = IntPtr.Zero Then ' Try the Windows Vista/7 TaskBar: startWnd = FindWindow("Button", Nothing) If startWnd = IntPtr.Zero Then ' Try an alternate way of Windows Vista/7 TaskBar: startWnd = GetVistaStartMenuWnd(taskBarWnd) End If End If ShowWindow(taskBarWnd, If(show, SW_SHOW, SW_HIDE)) ShowWindow(startWnd, If(show, SW_SHOW, SW_HIDE)) End Sub ''' <summary> ''' Returns the window handle of the Vista start menu orb. ''' </summary> ''' <param name="taskBarWnd">windo handle of taskbar</param> ''' <returns>window handle of start menu</returns> Private Shared Function GetVistaStartMenuWnd(taskBarWnd As IntPtr) As IntPtr ' get process that owns the taskbar window Dim procId As Integer GetWindowThreadProcessId(taskBarWnd, procId) Dim p As Process = Process.GetProcessById(procId) If p IsNot Nothing Then ' enumerate all threads of that process... For Each t As ProcessThread In p.Threads EnumThreadWindows(t.Id, AddressOf MyEnumThreadWindowsProc, IntPtr.Zero) Next End If Return vistaStartMenuWnd End Function ''' <summary> ''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'. ''' </summary> ''' <param name="hWnd">window handle</param> ''' <param name="lParam">parameter</param> ''' <returns>true to continue enumeration, false to stop it</returns> Private Shared Function MyEnumThreadWindowsProc(hWnd As IntPtr, lParam As IntPtr) As Boolean Dim buffer As New System.Text.StringBuilder(256) If GetWindowText(hWnd, buffer, buffer.Capacity) > 0 Then Console.WriteLine(buffer) If buffer.ToString() = VistaStartMenuCaption Then vistaStartMenuWnd = hWnd Return False End If End If Return True End Function End Class #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í: Imports System Imports System.Text Imports System.Runtime.InteropServices Imports System.Diagnostics Namespace TaskbarHide ''' <summary> ''' Helper class for hiding/showing the taskbar and startmenu on ''' Windows XP and Vista. ''' </summary> Public NotInheritable Class Taskbar Private Sub New() End Sub <DllImport("user32.dll")> _ Private Shared Function GetWindowText(hWnd As IntPtr, text As StringBuilder, count As Integer) As Integer End Function <DllImport("user32.dll", CharSet:=CharSet.Auto)> _ Private Shared Function EnumThreadWindows(threadId As Integer, pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean End Function <DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function FindWindow(lpClassName As String, lpWindowName As String) As System.IntPtr End Function <DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function FindWindowEx(parentHandle As IntPtr, childAfter As IntPtr, className As String, windowTitle As String) As IntPtr End Function <DllImport("user32.dll")> _ Private Shared Function FindWindowEx(parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String) As IntPtr End Function <DllImport("user32.dll")> _ Private Shared Function ShowWindow(hwnd As IntPtr, nCmdShow As Integer) As Integer End Function <DllImport("user32.dll")> _ Private Shared Function GetWindowThreadProcessId(hwnd As IntPtr, lpdwProcessId As Integer) As UInteger End Function Private Const SW_HIDE As Integer = 0 Private Const SW_SHOW As Integer = 5 Private Const VistaStartMenuCaption As String = "Start" Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero Private Delegate Function EnumThreadProc(hwnd As IntPtr, lParam As IntPtr) As Boolean ''' <summary> ''' Show the taskbar. ''' </summary> Public Shared Sub Show() SetVisibility(True) End Sub ''' <summary> ''' Hide the taskbar. ''' </summary> Public Shared Sub Hide() SetVisibility(False) End Sub ''' <summary> ''' Sets the visibility of the taskbar. ''' </summary> Public Shared WriteOnly Property Visible() As Boolean Set(value As Boolean) SetVisibility(value) End Set End Property ''' <summary> ''' Hide or show the Windows taskbar and startmenu. ''' </summary> ''' <param name="show">true to show, false to hide</param> Private Shared Sub SetVisibility(show As Boolean) ' get taskbar window Dim taskBarWnd As IntPtr = FindWindow("Shell_TrayWnd", Nothing) ' try it the WinXP way first... Dim startWnd As IntPtr = FindWindowEx(taskBarWnd, IntPtr.Zero, "Button", "Start") If startWnd = IntPtr.Zero Then ' try an alternate way, as mentioned on CodeProject by Earl Waylon Flinn startWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, CType(&HC017, IntPtr), "Start") End If If startWnd = IntPtr.Zero Then ' ok, let's try the Vista easy way... startWnd = FindWindow("Button", Nothing) If startWnd = IntPtr.Zero Then ' no chance, we need to to it the hard way... startWnd = GetVistaStartMenuWnd(taskBarWnd) End If End If ShowWindow(taskBarWnd, If(show, SW_SHOW, SW_HIDE)) ShowWindow(startWnd, If(show, SW_SHOW, SW_HIDE)) End Sub ''' <summary> ''' Returns the window handle of the Vista start menu orb. ''' </summary> ''' <param name="taskBarWnd">windo handle of taskbar</param> ''' <returns>window handle of start menu</returns> Private Shared Function GetVistaStartMenuWnd(taskBarWnd As IntPtr) As IntPtr ' get process that owns the taskbar window Dim procId As Integer GetWindowThreadProcessId(taskBarWnd, procId) Dim p As Process = Process.GetProcessById(procId) If p IsNot Nothing Then ' enumerate all threads of that process... For Each t As ProcessThread In p.Threads EnumThreadWindows(t.Id, AddressOf MyEnumThreadWindowsProc, IntPtr.Zero) Next End If Return vistaStartMenuWnd End Function ''' <summary> ''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'. ''' </summary> ''' <param name="hWnd">window handle</param> ''' <param name="lParam">parameter</param> ''' <returns>true to continue enumeration, false to stop it</returns> Private Shared Function MyEnumThreadWindowsProc(hWnd As IntPtr, lParam As IntPtr) As Boolean Dim buffer As New StringBuilder(256) If GetWindowText(hWnd, buffer, buffer.Capacity) > 0 Then Console.WriteLine(buffer) If buffer.ToString() = VistaStartMenuCaption Then vistaStartMenuWnd = hWnd Return False End If End If Return True End Function End Class End Namespace
|
|
|
|
|
|
|