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

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


  Mostrar Mensajes
Páginas: 1 ... 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 [920] 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 ... 1235
9191  Programación / .NET (C#, VB.NET, ASP) / Re: Pasar el nombre de una subrutina como argumento de una función? en: 19 Abril 2013, 19:45 pm
¿Nadie sabe como se puede hacer?
9192  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 19 Abril 2013, 19:34 pm
· Un Sub especial para el control de terceros "CButton", para modificar los colores (Y actualizar el estado de los colores).

http://www.codeproject.com/Articles/26622/Custom-Button-Control-with-Gradient-Colors-and-Ext

Código
  1. #Region " Change Cbutton Color "
  2.  
  3.    ' [ Change Cbutton Color ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples:
  8.    ' Change_Cbutton_Color(CButton1, Color.Black, Color.DarkRed, Color.Red)
  9.  
  10.  
  11.    Private Sub Change_Cbutton_Color(ByVal Button_Name As CButtonLib.CButton, _
  12.                                      ByVal Color1 As Color, _
  13.                                      ByVal Color2 As Color, _
  14.                                      ByVal Color3 As Color)
  15.  
  16.        Button_Name.ColorFillBlend.iColor(0) = Color1
  17.        Button_Name.ColorFillBlend.iColor(1) = Color2
  18.        Button_Name.ColorFillBlend.iColor(2) = Color3
  19.        Button_Name.UpdateDimBlends()
  20.  
  21.    End Sub
  22.  
  23. #End Region
9193  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 19 Abril 2013, 18:47 pm
· Setear los argumentos commandline por defecto del modo debug de la aplicación.

Código
  1. #Region " Set CommandLine Arguments "
  2.  
  3.    ' [ Set CommandLine Arguments Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples:
  8.    ' For Each Arg In Arguments : MsgBox(Arg) : Next
  9.  
  10.    Dim Arguments As List(Of String) = Set_CommandLine_Arguments()
  11.  
  12.    Public Function Set_CommandLine_Arguments() As List(Of String)
  13. #If DEBUG Then
  14.        ' Debug Commandline arguments for this application:
  15.        Dim DebugArguments = "Notepad.exe -Sleep 5 -Interval 50 -Key CTRL+C"
  16.        Return DebugArguments.Split(" ").ToList
  17. #Else
  18.        ' Nomal Commandline arguments
  19.        Return My.Application.CommandLineArgs.ToList
  20. #End If
  21.    End Function
  22.  
  23. #End Region


9194  Programación / Scripting / Re: Aprender algún lenguaje de Scripting en: 19 Abril 2013, 17:58 pm
Me permites la pregunta de... ¿Porque sabiendo dos lenguajes compilados, quieres aprender uno interpretado?, ¿No sería mejor para tí que profundizases en JAVA/C++?

Bueno, de todas formas, Ruby está al nivel de Python, y en mi opinión es más sencillo de aprender y usar.

Un saludo!
9195  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 19 Abril 2013, 17:42 pm
· Ejemplo de un String multi-línea para aplicaciones de consola:

Código
  1.        Dim Logo As String = <a><![CDATA[
  2.  ___              _ _           _   _               _____ _ _   _      
  3. / _ \            | (_)         | | (_)             |_   _(_) | | |    
  4. / /_\ \_ __  _ __ | |_  ___ __ _| |_ _  ___  _ __     | |  _| |_| | ___
  5. |  _  | '_ \| '_ \| | |/ __/ _` | __| |/ _ \| '_ \    | | | | __| |/ _ \
  6. | | | | |_) | |_) | | | (_| (_| | |_| | (_) | | | |   | | | | |_| |  __/
  7. \_| |_/ .__/| .__/|_|_|\___\__,_|\__|_|\___/|_| |_|   \_/ |_|\__|_|\___|
  8.      | |   | |                                                        
  9.      |_|   |_|                                                        
  10.  
  11. ]]></a>.Value
  12.  
  13. Console.WriteLine(Logo)

9196  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 19 Abril 2013, 04:22 am
· Animar la ventana con efectos

Código
  1. #Region " Animate Window "
  2.  
  3.    ' [ Animate Window ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' AnimateWindow(Me.Handle, 1500, Animation.Show_Fade)
  9.    ' AnimateWindow(Me.Handle, 1500, Animation.Hide_Center)
  10.  
  11.    Public Declare Function AnimateWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal dwtime As Int64, ByVal dwflags As Animation) As Boolean
  12.  
  13.    Public Enum Animation As Int32
  14.  
  15.        Show_Left_To_Right = 1
  16.        Show_Right_To_left = 2
  17.        Show_Top_To_Bottom = 4
  18.        Show_Bottom_to_top = 8
  19.        Show_Corner_Left_UP = 5
  20.        Show_Corner_Left_Down = 9
  21.        Show_Corner_Right_UP = 6
  22.        Show_Corner_Right_Down = 10
  23.        Show_Center = 16
  24.        Show_Fade = 524288
  25.  
  26.        Hide_Left_To_Right = 1 Or 65536
  27.        Hide_Right_To_left = 2 Or 65536
  28.        Hide_Top_To_Bottom = 4 Or 65536
  29.        Hide_Bottom_to_top = 8 Or 65536
  30.        Hide_Corner_Left_UP = 5 Or 65536
  31.        Hide_Corner_Left_Down = 9 Or 65536
  32.        Hide_Corner_Right_UP = 6 Or 65536
  33.        Hide_Corner_Right_Down = 10 Or 65536
  34.        Hide_Center = 16 Or 65536
  35.        Hide_Fade = 524288 Or 65536
  36.  
  37.    End Enum
  38.  
  39. #End Region
9197  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 19 Abril 2013, 00:27 am
A ver si alguien se anima y hace un snippet Anti-Sandbox, que según he leido es bien fácil: http://www.aspfree.com/c/a/braindump/virtualization-and-sandbox-detection/ pero por desgracia hay demasiados software virtualizadores para ponerse a probar uno por uno para hacer una función genérica...

PD: ¿A nadie le interesa aportar snippets aquí? :(

Saludos!
9198  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 19 Abril 2013, 00:06 am
· Detectar la ejecución de la aplicación en una máquina virtual.


Código
  1. #Region " Detect Virtual Machine "
  2.  
  3.    ' [ Detect Virtual Machine Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Instructions :
  8.    ' 1. Add a reference for "System.Management"
  9.    '
  10.    ' Examples :
  11.    ' MsgBox(Detect_Virtual_Machine)
  12.    ' If Detect_Virtual_Machine() Then MsgBox("This program cannot run on a virtual machine")
  13.  
  14.    Imports System.Management
  15.  
  16.    Private Function Detect_Virtual_Machine() As Boolean
  17.  
  18.        Dim ModelName As String = Nothing
  19.        Dim SearchQuery = New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE BytesPerSector > 0")
  20.  
  21.        For Each ManagementSystem In SearchQuery.Get
  22.  
  23.            ModelName = ManagementSystem("Model").ToString.Split(" ").First.ToLower
  24.  
  25.            If ModelName = "virtual" Or _
  26.               ModelName = "vmware" Or _
  27.               ModelName = "vbox" Or _
  28.               ModelName = "qemu" _
  29.            Then
  30.                Return True ' Virtual machine HDD Model Name found
  31.            End If
  32.  
  33.        Next
  34.  
  35.        Return False ' Virtual machine HDD Model Name not found
  36.  
  37.    End Function
  38.  
  39. #End Region
9199  Programación / .NET (C#, VB.NET, ASP) / Re: (ayuda) auto navegador en: 18 Abril 2013, 21:18 pm
Vale ya he visto tu proyecto,

el error es que estás deteniendo la ejecución del Thread al usar Thread.sleep.

El timer tickea cada 100 ms, y tu estás deteniendo el Thread por 5 segundos en cada Tick, BIG PROBLEM xD.

Te recomiendo que uses la propiedad interval del timer para ajustar el tiempo que deseas:
Código:
Timer1.Interval = 5 * 1000


Código
  1. Public Class Form1
  2.  
  3.    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  4.        ListBox1.Items.Add(TextBox1.Text) ' Añadimos el dato
  5.        TextBox1.SelectAll() ' Seleccionamos el texto
  6.        TextBox1.Select() ' y activamos el TextBox
  7.    End Sub
  8.  
  9.    Private Sub Timer1_Tick(Sender As Object, e As EventArgs) Handles Timer1.Tick
  10.        Static i As Integer = 0
  11.  
  12.        If i = ListBox1.Items.Count Then
  13.            Sender.Stop()
  14.            i = 0
  15.            MsgBox("Terminó la lista")
  16.        Else
  17.            ListBox1.SelectedIndex = i
  18.            WebBrowser1.Navigate(ListBox1.SelectedItem)
  19.            Me.Text = "Navegando en '" & ListBox1.SelectedItem & "'"
  20.            i += 1
  21.        End If
  22.  
  23.    End Sub
  24.  
  25.    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  26.        Timer1.Interval = 5 * 1000
  27.        Timer1.Start()
  28.    End Sub
  29.  
  30. End Class

EDITO: Otra forma de hacerlo, sin depender de un Timer, sería así:

Código
  1. Public Class Form1
  2.  
  3.    Dim Seconds As Long = 0
  4.  
  5.    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  6.        ListBox1.Items.Add(TextBox1.Text) ' Añadimos el dato
  7.        TextBox1.SelectAll() ' Seleccionamos el texto
  8.        TextBox1.Select() ' y activamos el TextBox
  9.    End Sub
  10.  
  11.    Private Sub NavigateListBox()
  12.        For Each URL As String In ListBox1.Items
  13.            Me.Text = "Navegando en '" & URL & "'"
  14.            WebBrowser1.Navigate(URL)
  15.            Sleep(Seconds) ' Segundos
  16.        Next
  17.    End Sub
  18.  
  19.    Private Sub Sleep(ByVal Duration As Int64)
  20.        Dim Starttime = DateTime.Now
  21.        Do While (DateTime.Now - Starttime).TotalSeconds < Duration : Application.DoEvents() : Loop
  22.    End Sub
  23.  
  24.    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  25.        NavigateListBox()
  26.    End Sub
  27.  
  28.    Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
  29.        Seconds = CLng(sender.text)
  30.    End Sub
  31.  
  32. End Class

Saludos!
9200  Programación / .NET (C#, VB.NET, ASP) / Re: (ayuda) auto navegador en: 18 Abril 2013, 21:05 pm
hmmm pues que raro, a mi si que me funciona corréctamente:

Código
  1.  
  2. public class class1
  3.  
  4.   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  5.        Me.ClientSize = New Point(640, 480)
  6.  
  7.        Dim ListBox1 As New ListBox, WebBrowser1 As New WebBrowser
  8.        ListBox1.Dock = DockStyle.Top : WebBrowser1.Dock = DockStyle.Bottom
  9.        Me.Controls.Add(ListBox1) : Me.Controls.Add(WebBrowser1)
  10.  
  11.        ListBox1.Items.Clear()
  12.        ListBox1.Items.Add("https://mega.co.nz/#!AdFTjLDb!BPFoK2i7Q25IzVmFxA2tBD-NvgQU3gL4Tez94cR1vHc")
  13.        ListBox1.SelectedIndex = 0
  14.  
  15.        WebBrowser1.Navigate(ListBox1.SelectedItem)
  16.    End Sub
  17.  
  18. end class

Prueba el código a ver si a ti te funciona como a mi, ¿Vale?

No se me ocurre porque puede ser.
Páginas: 1 ... 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 [920] 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 ... 1235
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines