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

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


  Mostrar Mensajes
Páginas: 1 ... 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 936 937 938 ... 1236
9221  Programación / Programación General / Re: Modificar idiomas de .exe en: 17 Abril 2013, 00:25 am
aquí tienes un pequeñísimo ejemplo:

http://foro.elhacker.net/scripting/deshabilitar_pestana_procesos_del_administardor_de_tareas-t378796.0.html;msg1811891#msg1811891



Saludos
9222  Programación / Scripting / Re: Acciones sobre archivos de texto. [Batch] en: 17 Abril 2013, 00:18 am
Lo que quiero es que en la ventana cmd pueda escribir el texto a añadir a todas las lineas del texto.
El que tu me pones la ventana cmd me pide el nombre del archivo de texto.

La idea es que partiendo del archivo frutero.txt (u otro nombre) la ventana cmd pida el texto a añadir a las lineas de ese archivo de texto.

Fíjate en el código, puedes pedir el texto a introducir exáctamente de la misma manera que se puede pedir el archivo de texto en el script que te he puesto de ejemplo. Te quise poner un ejemplo de las dos maneras.

Código:
Set /P /?

Citar
El modificador /P permite establecer el valor de una variable para una línea
de entrada escrita por el usuario. Muestra la cadena del símbolo del sistema
antes de leer la línea de entrada. La cadena del símbolo del sistema puede
estar vacía.

Saludos!
9223  Informática / Software / Re: [APORTE] MEGA-PACK para iniciarse en VS2012 x64 (Instalador + Recursos + Tools) en: 17 Abril 2013, 00:02 am
¡ Llegó la nueva versión del instalador !

He corregido un error que sufrieron algunas personas con la carpeta de instalación del VS en la version antigua de este instalador...
Además lo he optimizado tanto en el sistema de la instalación de los componentes, como en su desinstalación... ...Y contiene más librerías, más controles, y más snippets!


La instalación completa y la instalación por defecto han sido testeadas en Windows 7 de 32 y 64 Bits, en Windows XP tampoco debería haber problemas.



LO PUEDEN DESCARGAR DE FORMA DIRECTA EN EL COMENTARIO PRINCIPAL DE ESTE HILO.



         
9224  Informática / Software / Re: [APORTE] MEGA-PACK para iniciarse en VS2012 x64 (Instalador + Recursos + Tools) en: 17 Abril 2013, 00:00 am
De nada, eh? xD

Me ha hecho mucha gracia el video, es un tutorial express xD

"...Y después de instalar esto le pinchamos aquí para abrir el .NET, que tarda unas 400 horas en abrirse, pero yo ya lo tenia abierto así que..." X'D

Gracias por el video.

PD: El idioma por defecto de la IDE es Inglés, para poder elegir Español (como comentas en tu tuto) hay que instalar el idioma español para la IDe (Que va incluida en el instalador).
9225  Programación / Scripting / Re: Acciones sobre archivos de texto. [Batch] en: 16 Abril 2013, 22:32 pm
...Es decir: Como añadir un string al final de cada línea de un archivo de texto.

Pues así:

Código
  1. @Echo OFF
  2. Title Frutero
  3.  
  4. Set /P "InputText=Arrastra el archivo de texto... >> "
  5. Set "String= tiene fruta"
  6. Call :Writter "%InputText%" "%String%" ".\Frutero.txt"
  7. Pause&Exit
  8.  
  9. :Writter
  10. ((FOR /F "Usebackq Tokens=*" %%@ IN ("%~1") DO (Echo %%@%~2)) > %3) & (GOTO:EOF)


Saludos!
9226  Programación / .NET (C#, VB.NET, ASP) / Re: Ayuda en ejercicio basico en: 16 Abril 2013, 20:20 pm
Te está diciendo que intentas usar una variable que no tiene ningún valor asignado.

Asígnale un valor, y listo:

Código
  1. float primernumero = 0;
  2. float segundonumero = 0;
  3. float resultado = 0;
  4. string operacion = null;

El ¿porque?, pues me imagino que porque C# es así de restrictivo, no sé, no manejo C#... :P

Saludos!
9227  Programación / .NET (C#, VB.NET, ASP) / Re: Problema accediendo a un objecto en un Form !! en: 16 Abril 2013, 20:12 pm
Reference to a non-shared member requires an object reference.

este es el error que me atormenta

Pues no tienes que atormentarte xD, simplemente declara las cosas como compartidas (Shared), y listo.

Ejemplo:

Código
  1. Public Class Class1
  2.  
  3.    Public Shared SharedVar As String = "Test" ' Esta la podrás leer
  4.    Public Var As String = "Test"' Esta no la podrás leer
  5.  
  6. End Class

Código
  1. Imports WindowsApplication1.Class1
  2.  
  3. Public Class Form1
  4.    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  5.        MsgBox(SharedVar) ' String: "Test"
  6.        MsgBox(Var) ' Exception: Reference to a non-shared member requires an object reference
  7.    End Sub
  8. End Class

Saludos!
9228  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 16 Abril 2013, 16:38 pm
· Devuelve el valor de un nombre de un Enum

Código
  1. #Region " Get Enum Value "
  2.  
  3.    ' [ Get Enum Value Function ]
  4.    '
  5.    ' Examples :
  6.    ' MsgBox(Get_Enum_Value(DayOfWeek.Sunday)) ' Result: 0
  7.    ' MsgBox(Get_Enum_Value(DayOfWeek.Monday)) ' Result: 1
  8.  
  9.    Function Get_Enum_Value(Of T)(Byval ValueName As T) As Int32
  10.        Return Convert.ToInt32(ValueName)
  11.    End Function
  12.  
  13. #End Region




· Devuelve el nombre de un valor de un Enum

Código
  1. #Region " Get Enum Name "
  2.  
  3.    ' [ Get Enum ValueName Function ]
  4.    '
  5.    ' Examples :
  6.    ' MsgBox(Get_Enum_Name(Of DayOfWeek)(0)) ' Result: Sunday
  7.    ' MsgBox(Get_Enum_Name(Of DayOfWeek)(1)) ' Result: Monday
  8.  
  9.    Private Function Get_Enum_Name(Of T)(EnumValue As Integer) As String
  10.        Return [Enum].GetName(GetType(T), EnumValue)
  11.    End Function
  12.  
  13. #End Region





· Comparar dos archivos:

Código
  1. #Region " Compare Files "
  2.  
  3.    ' [ Compare Files Function ]
  4.    '
  5.    ' Examples :
  6.    ' MsgBox(Compare_Files("C:\File1.txt", "C:\File2.txt"))
  7.  
  8.    Private Function Compare_Files(ByVal File1 As String, ByVal File2 As String) As Boolean
  9.  
  10.        ' Set to true if the files are equal; false otherwise
  11.        Dim FilesAreEqual As Boolean = False
  12.  
  13.        With My.Computer.FileSystem
  14.  
  15.            ' Ensure that the files are the same length before comparing them line by line.
  16.            If .GetFileInfo(File1).Length = .GetFileInfo(File2).Length Then
  17.                Using file1Reader As New FileStream(File1, FileMode.Open), _
  18.                      file2Reader As New FileStream(File2, FileMode.Open)
  19.                    Dim byte1 As Integer = file1Reader.ReadByte()
  20.                    Dim byte2 As Integer = file2Reader.ReadByte()
  21.  
  22.                    ' If byte1 or byte2 is a negative value, we have reached the end of the file.
  23.                    While byte1 >= 0 AndAlso byte2 >= 0
  24.                        If (byte1 <> byte2) Then
  25.                            FilesAreEqual = False
  26.                            Exit While
  27.                        Else
  28.                            FilesAreEqual = True
  29.                        End If
  30.  
  31.                        ' Read the next byte.
  32.                        byte1 = file1Reader.ReadByte()
  33.                        byte2 = file2Reader.ReadByte()
  34.                    End While
  35.  
  36.                End Using
  37.            End If
  38.        End With
  39.  
  40.        Return FilesAreEqual
  41.    End Function
  42.  
  43. #End Region
9229  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 16 Abril 2013, 15:31 pm
· Un AppActivate distinto, en mi opinión mejor, se usa por el nombre del proceso, con posibilidad de seleccionar el proceso por el título de la ventana de dicho proceso:

Código
  1. #Region " Activate APP "
  2.  
  3.    ' [ Activate APP Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' ActivateAPP("notepad.exe")
  9.    ' ActivateAPP("notepad.exe", "Notepad Sub-Window Title")
  10.    ' MsgBox(ActivateAPP("notepad"))
  11.  
  12.    Private Function ActivateAPP(ByVal ProcessName As String, _
  13.                                 Optional ByVal WindowTitle As String = Nothing) As Boolean
  14.  
  15.        If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
  16.        Dim ProcessTitle As String = Nothing
  17.        Dim ProcessArray = Process.GetProcessesByName(ProcessName)
  18.  
  19.        If ProcessArray.Length = 0 Then : Return False ' ProcessName not found
  20.  
  21.        ElseIf ProcessArray.Length > 1 AndAlso Not WindowTitle Is Nothing Then
  22.            For Each Title In ProcessArray
  23.                If Title.MainWindowTitle.Contains(WindowTitle) Then _
  24.                   ProcessTitle = Title.MainWindowTitle
  25.            Next
  26.  
  27.        Else : ProcessTitle = ProcessArray(0).MainWindowTitle
  28.        End If
  29.  
  30.        AppActivate(ProcessTitle)
  31.        Return True ' Window activated
  32.  
  33.    End Function
  34.  
  35. #End Region




· Escribe texto en un Log

Código
  1. #Region " Write Log "
  2.  
  3.    ' [ Write Log Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' WriteLog("Application started", InfoType.Information)
  9.    ' WriteLog("Application got mad", InfoType.Critical)
  10.  
  11.    Dim LogFile = CurDir() & "\" & System.Reflection.Assembly.GetExecutingAssembly.GetName().Name & ".log"
  12.  
  13.    Public Enum InfoType
  14.        Information
  15.        Exception
  16.        Critical
  17.        None
  18.    End Enum
  19.  
  20.    Private Function WriteLog(ByVal Message As String, ByVal InfoType As InfoType) As Boolean
  21.        Dim LocalDate As String = My.Computer.Clock.LocalTime.ToString.Split(" ").First
  22.        Dim LocalTime As String = My.Computer.Clock.LocalTime.ToString.Split(" ").Last
  23.        Dim LogDate As String = "[ " & LocalDate & " ] " & " [ " & LocalTime & " ]  "
  24.        Dim MessageType As String = Nothing
  25.  
  26.        Select Case InfoType
  27.            Case InfoType.Information : MessageType = "Information: "
  28.            Case InfoType.Exception : MessageType = "Error: "
  29.            Case InfoType.Critical : MessageType = "Critical: "
  30.            Case InfoType.None : MessageType = ""
  31.        End Select
  32.  
  33.        Try
  34.            My.Computer.FileSystem.WriteAllText(LogFile, vbNewLine & LogDate & MessageType & Message & vbNewLine, True)
  35.            Return True
  36.        Catch ex As Exception
  37.            'Return False
  38.            Throw New Exception(ex.Message)
  39.        End Try
  40.  
  41.    End Function
  42.  
  43. #End Region





· Cierra un proceso (No lo mata)

Código
  1. #Region " Close Process Function "
  2.  
  3.    ' [ Close Process Function ]
  4.    '
  5.    ' Examples :
  6.    '
  7.    ' Close_Process(Application.ExecutablePath)
  8.    ' Close_Process("notepad.exe")
  9.    ' Close_Process("notepad", False)
  10.  
  11.    Private Function Close_Process(ByRef Process_Name As String, _
  12.                                   Optional ByVal OnlyFirstFound As Boolean = True) As Boolean
  13.  
  14.        If Process_Name.ToLower.EndsWith(".exe") Then Process_Name = Process_Name.Substring(0, Process_Name.Length - 4)
  15.        Dim proc() As Process = Process.GetProcessesByName(Process_Name)
  16.  
  17.        If Not OnlyFirstFound Then
  18.            For proc_num As Integer = 0 To proc.Length - 1
  19.                Try : proc(proc_num).CloseMainWindow() _
  20.                    : Catch : Return False : End Try ' One of the processes can't be closed
  21.            Next
  22.            Return True
  23.        Else
  24.            Try : proc(0).CloseMainWindow() : Return True ' Close message sent to the process
  25.            Catch : Return False : End Try ' Can't close the process
  26.        End If
  27.  
  28.        Return Nothing ' ProcessName not found
  29.  
  30.    End Function
  31.  
  32. #End Region





· Buscar coincidencias de texto usando expresiones regulares

Código
  1. #Region " Find RegEx "
  2.  
  3.    ' [ Find RegEx Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' If Find_RegEx("abcdef", "^[A-Z]+$") Then MsgBox("Yes") Else MsgBox("No") ' Result: No
  9.    ' If Find_RegEx("abcdef", "^[A-Z]+$", True) Then MsgBox("Yes") Else MsgBox("No") ' Result: Yes
  10.  
  11.    Private Function Find_RegEx(ByVal str As String, ByVal Pattern As String, _
  12.                                 Optional ByVal Ignorecase As Boolean = False) As Boolean
  13.  
  14.        Dim RegExCase As System.Text.RegularExpressions.RegexOptions
  15.  
  16.        If Ignorecase Then _
  17.             RegExCase = System.Text.RegularExpressions.RegexOptions.IgnoreCase _
  18.        Else RegExCase = System.Text.RegularExpressions.RegexOptions.None
  19.  
  20.        Dim RegEx As New System.Text.RegularExpressions.Regex(Pattern, RegExCase)
  21.  
  22.        Return RegEx.IsMatch(str)
  23.  
  24.    End Function
  25.  
  26. #End Region





· Leer un texto línea por línea (For each line...) con posibilidad de saltar líneas en blanco.

Código
  1. #Region " Read TextFile Libe By Line "
  2.  
  3.    ' [ Read TextFile Libe By Line ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' Read_TextFile_Libe_By_Line("C:\Test.txt")
  9.    ' Read_TextFile_Libe_By_Line("C:\Test.txt", True)
  10.  
  11.    Private Sub Read_TextFile_Libe_By_Line(ByVal TextFile As String, _
  12.                                           Optional ByVal Read_Blank_Lines As Boolean = False)
  13.        Dim Line As String = Nothing
  14.        Dim Text As IO.StreamReader = IO.File.OpenText(TextFile)
  15.        Dim RegEx As New System.Text.RegularExpressions.Regex("^\s+$")
  16.  
  17.        Do Until Text.EndOfStream
  18.  
  19.            Line = Text.ReadLine()
  20.  
  21.            If (Not Read_Blank_Lines _
  22.                AndAlso _
  23.               (Not Line = "" _
  24.                And Not RegEx.IsMatch(Line))) _
  25.                OrElse Read_Blank_Lines Then
  26.                ' Do things here...
  27.                MsgBox(Line)
  28.            End If
  29.  
  30.        Loop
  31.  
  32.        Text.Close() : Text.Dispose()
  33.  
  34.    End Sub
  35.  
  36. #End Region
9230  Programación / Programación General / Re: Modificar idiomas de .exe en: 16 Abril 2013, 13:32 pm
Lo que necesitas es el editor "PE Explorer", modificas los strings de las tablas y aplicas los cambios.

Saludos!
Páginas: 1 ... 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 936 937 938 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines