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

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Mensajes
Páginas: 1 ... 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 [982] 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 ... 1236
9811  Programación / Scripting / Re: Como puedo hacer un launcher asi, con VBS o con HTML, decidme en: 11 Enero 2013, 11:19 am
700 líneas de código para hacer un maldito launcher, y las líneas que faltan para acabarlo...

Si es que es una locura de código, como tu dices has cojido varios snippets, los has colocado y los has editado un poco,
yo tambíen uso muchas veces snippets de internet para ahorrarme el trabajo de hacerlo a mano, pero joder, hay que saber un poco lo que estás usando, hay código de JS, VBS, CSS y HTML, y no sabes casi nada de ninguno de los 4 lenguajes, lo digo sin ofender, es que no sé para que te metes a usar 4 lenguajes si los desconoces.

En fín, es una completa locura de código, como para encontrar el error, aunque alguien te arreglase el código un poco mañana te saldrían 50 errores más por la forma en la que haces las cosas, y aquí estamos para ayudar y enseñar, pero con un arreglo ni aprendes bien ni se arregla :xD.

Te repito mi consejo, hazlo en VB.NET, (en un par de líneas se hace), ya lo habrías terminado, deja de complicarte.





Te voy a decir las cosas que encuentro echándole un vistazo en el editor (no pienso esforzarme mucho en buscar errores)



Código:
objshell.run appdata & "\Ikillnukes\RUN.bat"
objshell.run appdata & "\Ikillnukes\OPT.hta"
A menos que cierres el argumento completo con comillas, cualquier usuario que tenga espacios en el nombre de la ruta no le funcionará.



Código:
Function runear()
setTimeout "ejecutar()",1000
End Function
Deberías buscar en Google lo que es una función, en tu HTA usas para todo funciones de VBS cuando estas no devuelven ningún valor, funcionar funcionan como un sub, pero es muy incorrecto lo que estás haciendo.



Cada pequeño código que veo de VBS lo separas en bloques, ¿Y si empiezas por juntar todos los VBS en un solo bloque?:
Código:
 <script type="text/javascript">
    TODOS los códigos de VBS aquí, comentados y organizados.
  </script>

Y lo mismo con los de JS y CSS.

Saludos!
9812  Programación / .NET (C#, VB.NET, ASP) / Como veo el standardoutput de la CMD en la própia CMD? en: 11 Enero 2013, 10:29 am
Estoy intentando hacer pruebas,

Lo que quiero es poder abrir un comando en la CMD y que la consola no se cierre, por ejemplo:

Código
  1.  My_Process_Info.FileName = "CMD.exe"
  2.        My_Process_Info.Arguments = "/k pause"

Pero la CMD se cierra.

Así que he intentado ejecutar un FOR de Batch muy largo en la CMD para ver si así no se cierra...
Código
  1.        My_Process_Info.FileName = "CMD.exe" ' Process filename
  2.        My_Process_Info.Arguments = "/k For /L %a in (1,1,100000) do echo afijgifjigjfgjifjgi" ' Process arguments

y no, no se cierra (Porque el FOR tarda en finalizar, cuando acaba si que se cierra claro xD) pero ahora lo que ocurre además es que el output de la CMD no se muestra en la CMD!, es decir, el FOR no muestra nada.

EDITO: Vale, he descubierto que el output no se muestra en la CMD porque al habilitar la propiedad de redireccionar el Standard u Error output, no muestra el output en la CMD.


Así que quiero solucionar los dos problemas:

1. Que la CMD no se cierre cuando finaliza la orden, el comando.
2. Que el output se muestre en la CMD cuando habilito la propiedad RedirectStandardOutput = True  y/o RedirectStandardError = True




Este es el code, es un snippet que estoy intentando hacer:
Código
  1. Dim My_Process As New Process()
  2.        Dim My_Process_Info As New ProcessStartInfo()
  3.  
  4.        My_Process_Info.FileName = "CMD.exe" ' Process filename
  5.        My_Process_Info.Arguments = "/k For /L %a in (1,1,100000) do echo afijgifjigjfgjifjgi" ' Process arguments
  6.        My_Process_Info.UseShellExecute = False ' Don't use system shell to execute the process
  7.        My_Process_Info.CreateNoWindow = False ' Show the CMD Window
  8.        My_Process_Info.RedirectStandardOutput = True '  Redirect (1) Output
  9.        My_Process_Info.RedirectStandardError = True ' Redirect non (1) Output
  10.        My_Process.EnableRaisingEvents = True
  11.        My_Process.StartInfo = My_Process_Info
  12.        My_Process.Start() ' Run the process
  13.        My_Process.WaitForExit() ' Wait X miliseconds to kill the process
  14.  
  15.        Dim Process_StandardOutput = My_Process.StandardOutput.ReadToEnd() ' Stores the Standard Output (If any)
  16.        Dim Process_ErrorOutput = My_Process.StandardOutput.ReadToEnd() ' Stores the Error Output (If any)
  17.        Dim Process_StartTime As String = My_Process.StartTime ' Stores the time when the process was launched
  18.        Dim Process_EndTime As String = My_Process.ExitTime ' Stores the time when the process was finished
  19.        Dim ERRORLEVEL = My_Process.ExitCode ' Stores the ExitCode of the process
  20.  
  21.        Dim result = Process_StartTime & vbNewLine & Process_EndTime & vbNewLine & ERRORLEVEL
  22.  
  23.        MsgBox(result)
  24.        MsgBox(Process_StandardOutput)
  25.        MsgBox(Process_ErrorOutput)
9813  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 11/01/2013) en: 11 Enero 2013, 09:39 am
Para una aplicación necesité dividir el tamaño de unos MEgaBytes entre la capacidad de un DVD5, así que ya puestos he hecho este snippet que divide el tamaño entre varios formatos de discos, para la próxima ocasión.

PD: Las medidas están sacadas de la Wikipedia, para los más...  :-X

Saludos.

Código
  1.    ' Usage:
  2.    '
  3.    ' MsgBox(ConvertToDiscSize(737280000, "Bytes", "CD"))
  4.    ' MsgBox(ConvertToDiscSize(700, "MB", "CD"))
  5.    ' MsgBox(Math.Ceiling(ConvertToDiscSize(6.5, "GB", "DVD")))
  6.    ' MsgBox(ConvertToDiscSize(40, "GB", "BR").ToString.Substring(0, 3) & " Discs")
  7.  
  8. #Region " Convert To Disc Size function"
  9.    Private Function ConvertToDiscSize(ByVal FileSize As Double, ByVal FileKindSize As String, ByVal To_DiscKindCapacity As String)
  10.  
  11.        ' KindSize Measures:
  12.        ' --------------------------
  13.        ' Bytes
  14.        ' KB
  15.        ' MB
  16.        ' GB
  17.  
  18.        ' ToDiscKind Measures:
  19.        ' -----------------------------
  20.        ' CD
  21.        ' CD800
  22.        ' CD900
  23.        ' DVD
  24.        ' DVD-DL
  25.        ' BR
  26.        ' BR-DL
  27.        ' BR-3L
  28.        ' BR-4L
  29.        ' BR-MD
  30.        ' BR-MD-DL
  31.  
  32.  
  33.        ' Bytes
  34.        If FileKindSize.ToUpper = "BYTES" Then
  35.            If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 737280000 ' CD Standard
  36.            If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 829440393.216 ' CD 800 MB
  37.            If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 912383803.392 ' CD 900 MB
  38.            If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4700000000 ' DVD Standard (DVD5
  39.            If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8500000000 ' DVD Double Layer (DVD9)
  40.            If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 25025314816 ' BluRay Standard
  41.            If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 50050629632 ' BluRay Double Layer
  42.            If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 100103356416 ' BluRay x3 Layers
  43.            If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 128001769472 ' BluRay x4 Layers
  44.            If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7791181824 ' BluRay MiniDisc Standard
  45.            If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 15582363648 ' BluRay MiniDisc Double Layer
  46.  
  47.            ' KB
  48.        ElseIf FileKindSize.ToUpper = "KB" Then
  49.            If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 720000 ' CD Standard
  50.            If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 810000.384 ' CD 800 MB
  51.            If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 890999.808 ' CD 900 MB
  52.            If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4589843.75 ' DVD Standard (DVD5)
  53.            If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8300781.25 ' DVD Double Layer (DVD9)
  54.            If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 24438784 ' BluRay Standard
  55.            If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 48877568 ' BluRay Double Layer
  56.            If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 97757184 ' BluRay x3 Layers
  57.            If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 125001728 ' BluRay x4 Layers
  58.            If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7608576 ' BluRay MiniDisc Standard
  59.            If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 15217152 ' BluRay MiniDisc Double Layer
  60.  
  61.            ' MB
  62.        ElseIf FileKindSize.ToUpper = "MB" Then
  63.            If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 703.125 ' CD Standard
  64.            If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 791.016 ' CD 800 MB
  65.            If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 870.117 ' CD 900 MB
  66.            If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4482.26929 ' DVD Standard (DVD5)
  67.            If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8106.23169 ' DVD Double Layer (DVD9)
  68.            If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 23866 ' BluRay Standard
  69.            If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 47732 ' BluRay Double Layer
  70.            If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 95466 ' BluRay x3 Layers
  71.            If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 122072 ' BluRay x4 Layers
  72.            If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7430.25 ' BluRay MiniDisc Standard
  73.            If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 14860.5 ' BluRay MiniDisc Double Layer
  74.  
  75.            ' GB
  76.        ElseIf FileKindSize.ToUpper = "GB" Then
  77.            If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 0.68665 ' CD Standard
  78.            If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 0.77248 ' CD 800 MB
  79.            If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 0.84972 ' CD 900 MB
  80.            If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4.37722 ' DVD Standard (DVD5)
  81.            If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 7.91624 ' DVD Double Layer (DVD9)
  82.            If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 23.30664 ' BluRay Standard
  83.            If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 46.61328 ' BluRay Double Layer
  84.            If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 93.22852 ' BluRay x3 Layers
  85.            If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 119.21094 ' BluRay x4 Layers
  86.            If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7.2561 ' BluRay MiniDisc Standard
  87.            If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 14.51221 ' BluRay MiniDisc Double Layer
  88.        End If
  89.  
  90.        Return Nothing ' Argument measure not found
  91.  
  92.    End Function
  93. #End Region
9814  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 21/12/2012) en: 11 Enero 2013, 06:30 am
Deberían hacer un post en esta sección que contenga sólamente snippets y donde todos aporten snippets útiles  ;D





He hecho este snippet para agilizar el renombramiento de archivos, aquí tienen ;)

PD: Uso "MOVE" porque de otra forma es imposible renombrar el archivo con el mismo nombre, como bien está explicado aquí por NovLucker: http://foro.elhacker.net/net/solucionado_iquestcomo_renombrar_un_archivo_o_carpeta_con_el_mismo_nombre-t378839.0.html

Código
  1.   ' Usage:
  2.    '
  3.    ' RenameFile("C:\Test.txt", "TeSt.TxT")
  4.    ' RenameFile("C:\Test.txt", "Test", "doc")
  5.    ' RenameFile(FileInfoObject.FullName, FileInfoObject.Name.ToLower, FileInfoObject.Extension.ToUpper)
  6.    ' If RenameFile("C:\Test.txt", "TeSt.TxT") Is Nothing Then MsgBox("El archivo no existe!")
  7.  
  8. #Region " RenameFile function "
  9.  
  10.    Private Function RenameFile(ByVal File As String, ByVal NewFileName As String, Optional ByVal NewFileExtension As String = Nothing)
  11.        If IO.File.Exists(File) Then
  12.            Try
  13.                Dim FileToBeRenamed As New System.IO.FileInfo(File)
  14.                If NewFileExtension Is Nothing Then
  15.                    FileToBeRenamed.MoveTo(FileToBeRenamed.Directory.FullName & "\" & NewFileName) ' Rename file with same extension
  16.                Else
  17.                    FileToBeRenamed.MoveTo(FileToBeRenamed.Directory.FullName & "\" & NewFileName & NewFileExtension) ' Rename file with new extension
  18.                End If
  19.                Return True ' File was renamed OK
  20.            Catch ex As Exception
  21.                ' MsgBox(ex.Message)
  22.                Return False ' File can't be renamed maybe because User Permissions
  23.            End Try
  24.        Else
  25.            Return Nothing ' File doesn't exist
  26.        End If
  27.    End Function
  28.  
  29. #End Region

Y unos cuantos más...

Modificar atributos de archivos:
Código
  1.   ' Usage:
  2.    ' Attrib("File.txt", IO.FileAttributes.ReadOnly + IO.FileAttributes.Hidden)
  3.    ' If Attrib("File.txt", IO.FileAttributes.System) Is Nothing Then MsgBox("File doesn't exist!")
  4.  
  5.      Private Function Attrib(ByVal File As String, ByVal Attributes As System.IO.FileAttributes)
  6.        If IO.File.Exists(File) Then
  7.            Try
  8.                FileSystem.SetAttr(File, Attributes)
  9.                Return True ' File was modified OK
  10.            Catch ex As Exception
  11.                ' MsgBox(ex.Message)
  12.                Return False ' File can't be modified maybe because User Permissions
  13.            End Try
  14.        Else
  15.            Return Nothing ' File doesn't exist
  16.        End If
  17.    End Function


Controlar el mismo evento para varios controles:

Código
  1.   Private Sub Button_Is_Clicked(sender As Object, e As EventArgs) Handles _
  2.        Button1.Click, _
  3.        Button2.Click, _
  4.        Button3.Click
  5.  
  6.        Dim Clicked_Button As Button = CType(sender, Button)
  7.  
  8.        If Clicked_Button.Name = "Button1" Then
  9.        ' Things for Button1
  10.        ElseIf Clicked_Button.Name = "Button2" Then
  11.        ' Things for Button2
  12.        ElseIf Clicked_Button.Name = "Button3" Then
  13.        ' Things for Button3
  14.        End If
  15.    Ens Sub

Un link label:

Código
  1.    ' First add a LinkLabel control into the form.
  2.  
  3.    Private Sub LinkLabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
  4.        System.Diagnostics.Process.Start("http://www.Google.com")
  5.        System.Diagnostics.Process.Start("mailto:ME@Hotmail.com")
  6.    End Sub

Procesar todos los archivos de texto de My.Resources:

Código
  1.        For Each ResourceFile As DictionaryEntry In My.Resources.ResourceManager.GetResourceSet(Globalization.CultureInfo.CurrentCulture, True, True).OfType(Of Object)()
  2.            If TypeOf (ResourceFile.Value) Is String Then
  3.                MsgBox(My.Resources.ResourceManager.GetObject(ResourceFile.Key))
  4.                'MsgBox(ResourceFile.Key)   ' Resource Name
  5.                'MsgBox(ResourceFile.Value) ' Resource FileContent
  6.            End If
  7.        Next

Procesar todos los archivos de imagen de My.Resources:

Código
  1.        For Each ResourceFile As DictionaryEntry In My.Resources.ResourceManager.GetResourceSet(Globalization.CultureInfo.CurrentCulture, True, True).OfType(Of Object)()
  2.            If TypeOf (ResourceFile.Value) Is Drawing.Image Then
  3.                Button_2000_2006.Image = ResourceFile.Value
  4.                'MsgBox(ResourceFile.Key)   ' Resource Name
  5.                'MsgBox(ResourceFile.Value) ' Resource FileContent
  6.            End If
  7.        Next

Ordenar un listview al clickar sobre la columna a ordenar:

Código
  1. ' Instructions:
  2. ' 1. Add the class
  3. ' 2. Add the declaration
  4. ' 3. Add a listview
  5.  
  6.  
  7. Dim ColumnOrder As String = "Down"
  8.  
  9.  
  10. #Region " ListView Sort Column event "
  11.  
  12.    Private Sub ListView_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView1.ColumnClick
  13.        If ColumnOrder = "Down" Then
  14.            Me.ListView1.ListViewItemSorter = New OrdenarListview(e.Column, SortOrder.Ascending)
  15.            ListView1.Sort()
  16.            ColumnOrder = "Up"
  17.        ElseIf ColumnOrder = "Up" Then
  18.            Me.ListView1.ListViewItemSorter = New OrdenarListview(e.Column, SortOrder.Descending)
  19.            ListView1.Sort()
  20.            ColumnOrder = "Down"
  21.        End If
  22.    End Sub
  23.  
  24.  
  25. #End Region
  26.  
  27.  
  28. #Region " OrdenarListView [CLASS] "
  29.  
  30. Public Class OrdenarListview
  31.    Implements IComparer
  32.  
  33.    Private vIndiceColumna As Integer
  34.    Private vTipoOrden As SortOrder
  35.  
  36.    Public Sub New(ByVal pIndiceColumna As Integer, ByVal pTipoOrden As SortOrder)
  37.        vIndiceColumna = pIndiceColumna
  38.        vTipoOrden = pTipoOrden
  39.    End Sub
  40.  
  41.    Public Function Ordenar(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
  42.        Dim item_x As ListViewItem = DirectCast(x, ListViewItem)
  43.        Dim item_y As ListViewItem = DirectCast(y, ListViewItem)
  44.  
  45.        Dim string_x As String
  46.  
  47.        If item_x.SubItems.Count <= vIndiceColumna Then
  48.            string_x = ""
  49.        Else
  50.            string_x = item_x.SubItems(vIndiceColumna).Text
  51.        End If
  52.  
  53.        Dim string_y As String
  54.        If item_y.SubItems.Count <= vIndiceColumna Then
  55.            string_y = ""
  56.        Else
  57.            string_y = item_y.SubItems(vIndiceColumna).Text
  58.        End If
  59.  
  60.        If vTipoOrden = SortOrder.Ascending Then
  61.            If IsNumeric(string_x) And IsNumeric(string_y) Then
  62.                Return Val(string_x).CompareTo(Val(string_y))
  63.            ElseIf IsDate(string_x) And IsDate(string_y) Then
  64.                Return DateTime.Parse(string_x).CompareTo(DateTime.Parse(string_y))
  65.            Else
  66.                Return String.Compare(string_x, string_y)
  67.            End If
  68.        Else
  69.            If IsNumeric(string_x) And IsNumeric(string_y) Then
  70.                Return Val(string_y).CompareTo(Val(string_x))
  71.            ElseIf IsDate(string_x) And IsDate(string_y) Then
  72.                Return DateTime.Parse(string_y).CompareTo(DateTime.Parse(string_x))
  73.            Else
  74.                Return String.Compare(string_y, string_x)
  75.            End If
  76.        End If
  77.    End Function
  78. End Class
  79.  
  80. #End Region

Un ejemplo de un SaveFileDialog:

Código
  1.        Dim SaveFile As New SaveFileDialog
  2.        SaveFile.Title = "Save a Report File"
  3.        SaveFile.InitialDirectory = Environ("programfiles")
  4.        SaveFile.RestoreDirectory = True
  5.        SaveFile.DefaultExt = "txt"
  6.        SaveFile.Filter = "txt file (*.txt)|*.txt"
  7.        SaveFile.CheckPathExists = True
  8.        'SaveFile.CheckFileExists = True
  9.        'SaveFile.ShowDialog()
  10.  
  11.        If SaveFile.ShowDialog() = DialogResult.OK Then
  12.          MsgBox(SaveFile.FileName)
  13.        End If

Centrar un form secundario en el form principal:

Código
  1. #Region " CenterForm function "
  2.  
  3.    Function CenterForm(ByVal Form_to_Center As Form, ByVal Form_Location As Point) As Point
  4.        Dim FormLocation As New Point
  5.        FormLocation.X = (Me.Left + (Me.Width - Form_to_Center.Width) / 2) ' set the X coordinates.
  6.        FormLocation.Y = (Me.Top + (Me.Height - Form_to_Center.Height) / 2) ' set the Y coordinates.
  7.        Return FormLocation ' return the Location to the Form it was called from.
  8.    End Function
  9.  
  10. #End Region
  11.  
  12.    ' Form2 Load
  13.    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  14.        Me.Location = Form1.centerForm(Me, Me.Location)
  15.    End Sub
  16.  
  17.    ' Private Sub Button_MouseHover(sender As Object, e As EventArgs) Handles Button1.MouseHover
  18.    '     Form2.Show()
  19.    ' End Sub
  20.  
  21.    ' Private Sub Button_MouseLeave(sender As Object, e As EventArgs) Handles Button1.MouseLeave
  22.    '     Form2.Dispose()
  23.    ' End Sub


Saludos!
9815  Programación / Scripting / Re: Como puedo hacer un launcher asi, con VBS o con HTML, decidme en: 11 Enero 2013, 04:28 am
Tienes que resubir el archivo, no es descargable xD.

Saludos
9816  Media / Diseño Gráfico / Re: Busco iconos de años (50s,60s,70s,80s,90s,2000,2001,2002,etc...) en: 11 Enero 2013, 04:25 am
Gracias, pero quedaría todo muy "aleatório", no creo que pueda encontrar imagenes de ese estilo con el "año" y que sigan el mismo patrón... eso es lo que quiero evitar.

Saludos!
9817  Media / Multimedia / Re: Dónde descargar música? en: 11 Enero 2013, 04:02 am
http://www2.mrtzcmp3.net

Es lo mejor y más variado que hay (Mejor que el beemp3 y mp3skull, apúntatelas también), tiene un límite de 20 o 30 archivos al día, que se puede saltear muy fácilmente usando un proxy (UltraSurf).

Saludos
9818  Programación / Programación General / [APORTE] Lección útil para bebés 1.0 en: 11 Enero 2013, 03:57 am
UPS, ME EQUIVOQUÉ DE SECCIÓN, LO PUEDEN MOVER A VB.NET PORFAVOR? XD SORRY









Estaba ayudando a un user que no sabía como usar una barra de progreso, y bueno, hice este form.

Cuando lo completé me dí cuenta de que a mi me habría servido cuando no sabía hacer nada de esto, así que quiero compartirlo por si a alguien le puede servir :xD

Cita de: Yo en otro foro
Con mi ejemplo puedes aprender a...:
· Crear / Añadir controles en tiempo de ejecución,
· Modificar algunas propiedades de controles
· Asociar el evento de un control en tiempo de ejecución a una subrutina
· Usar las variables de entorno
· Obtener todos los archivos de un directorio
· Crear un array y procesar su contenido
· Usar y conocer una barra de progreso,
· Algunos métodos útiles como "Update"

Eso sí, sin threads, esto es un ejemplo MUY básico.

PD: En serio, no quiero comentarios como "Esto no vale nada", si no te gusta no comentes, a un novato le servirá.

 


Código
  1. Public Class Form1
  2.  
  3.  
  4.    ' Declaro los controles que vamos a usar en este form:
  5.    Dim Label_Origen As New Label
  6.    Dim Label_Destino As New Label
  7.    Dim Label_FileName As New Label
  8.    Dim Label_Restantes As New Label
  9.    Dim WithEvents Button_Copiar As New Button
  10.    Dim ProgressBar_1 As New ProgressBar
  11.  
  12.  
  13.    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  14.  
  15.        Me.Size = New Point(420, 320)
  16.        ' Le otorgo las propiedades a los controles
  17.        ' -------------------------------------------------------
  18.        ' Label Origen
  19.        Dim Fuente As New Font("Sans Serif", 20, FontStyle.Regular) ' Seteo la fuente personalizada que quiero usar, porque me apetece usar una distinta y así aprendes xD
  20.        Label_Origen.Font = Fuente
  21.        Label_Origen.Text = "Origen: " & Environment.GetFolderPath(Environment.SpecialFolder.Windows) & "\Fonts"
  22.        Label_Origen.AutoSize = False
  23.        Label_Origen.Size = New Point(640, 40)
  24.        Label_Origen.Location = New Point(0, 0)
  25.        ' Label Destino
  26.        Label_Destino.Font = Fuente
  27.        Label_Destino.Text = "Destino: " & Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\Test" ' O Environment.SpecialFolder.ProgramFilesX86
  28.        Label_Destino.AutoSize = False
  29.        Label_Destino.Size = New Point(640, 40)
  30.        Label_Destino.Location = New Point(0, 50)
  31.        ' Botón Copiar
  32.        Button_Copiar.Size = New Point(180, 80)
  33.        Button_Copiar.Text = "Copiar!"
  34.        Button_Copiar.Location = New Point(100, 100)
  35.        AddHandler Button_Copiar.Click, AddressOf Button_Copiar_Sub ' Añado el evento "Click" que sucede cuando pinchas el botón, y se llama a la subrutina "Button_Copiar_Sub"
  36.        ' ProgressBar_1
  37.        ProgressBar_1.Size = New Point(180, 20)
  38.        ProgressBar_1.Location = New Point(100, 200)
  39.        ' Label FileName
  40.        Label_FileName.AutoSize = True
  41.        Label_FileName.Location = New Point(100, 230)
  42.        ' Label Restantes
  43.        Label_Restantes.AutoSize = True
  44.        Label_Restantes.Location = New Point(100, 250)
  45.  
  46.        ' Añado los controles al form principal:
  47.        Me.Controls.Add(Label_Origen)
  48.        Me.Controls.Add(Label_Destino)
  49.        Me.Controls.Add(Button_Copiar)
  50.        Me.Controls.Add(ProgressBar_1)
  51.        Me.Controls.Add(Label_FileName)
  52.        Me.Controls.Add(Label_Restantes)
  53.    End Sub
  54.  
  55.  
  56.    Private Sub Button_Copiar_Sub(sender As Object, e As EventArgs)
  57.  
  58.        ' Seteo las variables de origen y destino de carpetas
  59.        Dim Origen As String = Label_Origen.Text.Split(" ")(1)
  60.        Dim Destino As String = Label_Destino.Text.Split(" ")(1)
  61.  
  62.        ' Creo un array con todos los archivos del directorio de origen
  63.        Dim Directory As New System.IO.DirectoryInfo(Origen)
  64.        Dim Array_Files As System.IO.FileInfo() = Directory.GetFiles("*")
  65.  
  66.        ' A la progressBar tenemos que darle un valor "Máximo" (SIEMPRE) (El máximo por defecto es 100, pero si tenemos 101 archivos nos joderá porque no podemos sobrepasar el Máximo),
  67.        ' Ese valor en este caso es el número total de archivos que contiene el directorio.
  68.        ProgressBar_1.Maximum = Array_Files.Length
  69.  
  70.        ' Por cada archivo del Array, sumamos un valor a la ProgressBar, y realizamos las operaciones de copiado o lo que queramos...
  71.        For Each File In Array_Files
  72.            Label_FileName.Text = "Archivo copiado: " & File.Name
  73.            Label_FileName.Update() ' Como no estoy usando threads, tengo que actualizar el estado del label para darle prioridad y que se muestre correctamente, lo cúal ralentiza bastante (BASTANTE) el proceso. Para estas cosas ya te digo que se deben usar Threads + delegados
  74.            Threading.Thread.Sleep(20) ' Le hago esperar 20 ms a este hilo símplemente para que veas bien como se actualiza el proceso de la barra de progreso.
  75.            ProgressBar_1.Value += 1
  76.            Label_Restantes.Text = "Faltan " & (ProgressBar_1.Maximum - ProgressBar_1.Value) & " archivos por copiarse"
  77.            Label_Restantes.Update() ' Otra vez el update necesario para poder mostrar el estado del label, más ralentización para el hilo, de verdad, estudia sobre los threads y cuando sepas algo te ayudaré a entenderlos y usarlos.
  78.        Next
  79.  
  80.        ' Devolvemos los valores originales a la ProgressBar y modificamos los valores de los labels
  81.        ProgressBar_1.Value = 0
  82.        ProgressBar_1.Maximum = 100
  83.        Label_FileName.Text = Nothing
  84.        Label_Restantes.Text = "Todos los archivos copiados."
  85.  
  86.    End Sub
  87.  
  88.  
  89. End Class
9819  Programación / .NET (C#, VB.NET, ASP) / Re: OMG! ¿Como corrijo esta visualización del Aero? en: 11 Enero 2013, 03:40 am
y por cierto esos tonos negros, me dejan ciego... cansa la vista...

Sé que cansan, a mi no me gusta todo tán oscuro, quería buscar la armonía entre "oscuros/grises/casi blancos" para los users que usan AERO y me encuentro con eso!,
no me negarás que los tonos DEFAULT blancos de la segunda imagen cansan MUCHO más que los negros de la primera imagen xD.

En fin, me decanto por usar groupboxes de terceros como han comentado, y los botones no me queda otra que dejarlos en flat o buscar algún buen botón de terceros que no use los estilos visuales de Windows.

Saludos!
9820  Programación / .NET (C#, VB.NET, ASP) / Re: OMG! ¿Como corrijo esta visualización del Aero? en: 11 Enero 2013, 01:15 am
@NovLucker
Segúramente no lo llegaste a leer, pero dije que ya probé a desactivar los estilos visuales, y se ve mucho peor, si lo desactivo, todos los PNG que uso se ven mal.

@Spiritdead
Quien me iba a decir a mí que para introducirme en .NET y hacer las cosas bien necesitaría ponerme a reinventar todos los controles existentes por un maldito borde... puf! si eso es para gente muy avanzada. :(

@Seba123Neo
Siempre uso los colores "WEB" o le pongo "ARGB" customizados,
pero no veo que haya ninguna propiedad para cambiar el color de los bordes de los groupboxes... Sé que todos vosotros desarrollais con AERO... por eso pregunto: ¿No os pasa lo mismo en AERO? :(

Para cambiar el color del borde de los botones tengo que ponerlo en "Flat" y ahi ya puedo tocar las propiedades del FlatStyle, pero es que los groupboces...me matan, maldito Aero.

Me he informado bastante y he leido que en los forms WPF el borde es incluso mayor, y es mayor en Windows 7 que si ejecutas la misma APP en WinXP, eso es lo que se comenta...

Un saludo!
Páginas: 1 ... 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 [982] 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines