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

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Temas
Páginas: 1 ... 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 [84] 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ... 105
831  Programación / .NET (C#, VB.NET, ASP) / Como puedo crear este thread? en: 26 Noviembre 2012, 12:44 pm
Hola,

A ver, tengo un richtextbox que "printa" información hasta finalizar el búcle FOR

Lo que pasa es que mi form se cuelga, no puedo tocar NADA,
Lo que necesito es poder detener (detener del todo) el proceso o mantenerlo en espera (Pause) mediante un botón, o un evento de teclado, o las dos cosas!, pero preferiblemente un botón que esté destinado a pausar el proceso, y otro botón destinado a detener el proceso por completo.

¿Alguien me puede indicar como hacerlo porfavor? No lo quiero hecho, quiero aprender a hacerlo pero no se por donde buscar!

Muchas gracias.



Código
  1.    Public Sub MediaInfoWorkWithFilesInDir(ByVal aDir As DirectoryInfo)
  2.  
  3.        Dim aFile As FileInfo
  4.        For Each aFile In aDir.GetFiles()
  5.            If accepted_extensions.ToLower.Contains(aFile.Extension.ToLower) Then
  6.  
  7.                MI.Open(aFile.FullName)
  8.  
  9.                Dim Pos As Integer = 0
  10.                To_Display = Nothing
  11.                While Pos < MI.Count_Get(StreamKind.Audio)
  12.                    To_Display += "| " + MI.Get_(StreamKind.Audio, Pos, "Format")
  13.                    System.Math.Max(System.Threading.Interlocked.Increment(Pos), Pos - 1)
  14.                End While
  15.  
  16.                consolebox.AppendText("Processing: " + aFile.ToString() + To_Display.ToString() + vbNewLine)
  17.                consolebox.SelectionStart = consolebox.Text.Length
  18.                consolebox.ScrollToCaret()
  19.  
  20.            End If
  21.        Next
  22.    End Sub
  23.  
832  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Se puede mejorar este FOR? en: 26 Noviembre 2012, 10:15 am
Hola,

Mi app trabaja sobre MILES de archivos y quisiera saber si puedo mejorar este for para disminuir el tiempo de procesado:

Código
  1.  
  2. Dim accepted_extensions As String = ".264 .3gp .asf .asx .avi .avc .bsf .bdmv .divx .dv .evo .f4v .flv .hdmov .m1v .m2t .m2ts .m2v .m4v .mkv .mov .mp4 .mpeg .mpg .mpv4 .mts .ogm .ogv .qt .rmvb .swf .ts .vob .webm .wmv"
  3.  
  4.    Public Sub PlaylistsWorkWithFilesInDir(ByVal aDir As DirectoryInfo)
  5.        consolebox.AppendText("Processing: " + aDir.ToString() + vbNewLine)
  6.        consolebox.SelectionStart = consolebox.Text.Length
  7.        consolebox.ScrollToCaret()
  8.        Dim aFile As FileInfo
  9.        For Each aFile In aDir.GetFiles()
  10.            If accepted_extensions.ToLower.Contains(aFile.Extension.ToLower) Then
  11.                Using writer As StreamWriter = New StreamWriter(aFile.DirectoryName.ToString() & "\" & aDir.Name & ".m3u", True, System.Text.Encoding.UTF8)
  12.                    writer.WriteLine(aFile.FullName.ToString())
  13.                End Using
  14.            End If
  15.        Next
  16.    End Sub
  17.  

Me pregunto si existirá algún método en el sistema para comprobar si el archivo es un archivo de video, algo así:
Código:
If IO.FileType(aFile) = "VideoFile" Then...
833  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Mostrar el output de la CMD en: 25 Noviembre 2012, 20:05 pm
Hola,

Tengo una pregunta antes de la verdadera pregunta xD

¿Que control es el más adecuado para mostrar el output de la CMD?  (Estoy usando un richtextbox)

Y bueno, el problema es que no consigo que el texto cambie antes d emostrar el output:
Código
  1. Me.consolebox.Text = "Deleting the attributes of the files..."

Todo lo demás funciona bien, pero no consigo mostrar ese string, se queda el richtextbox vacío hasta que finaliza el búcle...

Código
  1.   Private Function attrib() As Boolean
  2.        Me.consolebox.Text = "Deleting the attributes of the files..."
  3.        Dim attrib_process As New Process()
  4.        Dim attrib_startinfo As New ProcessStartInfo()
  5.        Dim attrib_args As String = videofolder
  6.        attrib_startinfo.FileName = "cmd.exe "
  7.        attrib_startinfo.UseShellExecute = False
  8.        attrib_startinfo.CreateNoWindow = True
  9.        attrib_startinfo.Arguments = "/C PUSHD " & ControlChars.Quote & videofolder & ControlChars.Quote & " & Attrib -A -R -S -H -I /S *.* & attrib +H /S *.ico >nul & attrib +H -R /S *.ini >nul"
  10.        attrib_startinfo.RedirectStandardOutput = True
  11.        attrib_process.EnableRaisingEvents = True
  12.        attrib_process.StartInfo = attrib_startinfo
  13.        attrib_process.Start()
  14.        Dim readerStdOut As IO.StreamReader = attrib_process.StandardOutput
  15.        Do While readerStdOut.EndOfStream = False
  16.            output = output + readerStdOut.ReadLine()
  17.        Loop
  18.        Me.consolebox.Text = "This is the result of the command:" + output
  19.    End Function

¿Y si necesito usar un comando de múltiples líneas como le hago?

por ejemplo:
Código
  1. attrib_startinfo.Arguments = "/C
  2. Echo linea 1 &
  3. (Echo linea2
  4. Echo linea 3)
  5. "
834  Sistemas Operativos / Windows / Firefox - Script seamonkey para desmarcar checkbox en una página? en: 25 Noviembre 2012, 11:35 am
MOD: Perdón, tuve un error, juraría que posteé esto en dudas generales, si me lo pudieran mover allá...




Hola,

Como navegador uso Firefox

Y actualmente yo no uso seamonkey, uso una extensión que se llama "customizeyourweb" https://addons.mozilla.org/en-us/firefox/addon/customize-your-web/

Me gustaría saber si en este tipo de extensiones parecidas al seamonkey hay alguna forma de desmarcar una casilla en una página web que siempre aparece la casilla marcada.

Gracias.
835  Programación / .NET (C#, VB.NET, ASP) / Ayuda para corregir error visual redrawing effect en mi form en: 24 Noviembre 2012, 09:41 am
Como reproducir este error?

1. Crear un nuevo winform

2. Seleccionar una imagen de fondo para el form

3. Añadir un panel

4. Cambiar la spropiedades del panel a "Color=Transparent", "AutoScroll=True", y añadr unos cuantos controles dentro del panel.

Ejemplo:




5. Ahora scrollear arriba o abajo y...








¿Como corregir este error?

Yo: He probado todo lo que me han aconsejado expertos, y sigo sin tener idea.

El método de Invalidate o Refresh soamente disimulan el problema real y crean otro problema, porque se "flashea" el panel todo el rato si scrolleamos.

Una solución sería crear una vScrollbar para mi panel, y cambiar el mínimo de scroll-lines al usar la mouse-wheel, por ejemplo scrollear 15 lineas en vez de las 6 por defecto, ya que si scrolleo una página entera no tengo ningún problema visual. Pero esto no se hacerlo por mi mismo, si alguien me pudiera dar un ejemplo se lo agradecería mucho, pues con esto ya podría terminar mi app.





Más información:

(Supuestas soluciones que a mi no me han servido del todo, quizás no he sabido usarlas correctamente)

http://stackoverflow.com/questions/13516557/visual-problems-with-the-form-background-image
http://stackoverflow.com/questions/13535693/change-mouse-wheel-scroll-lines
http://www.daniweb.com/software-development/vbnet/threads/441204/how-to-correct-a-redrawing-background-cutted-effect-inside-a-panel
http://www.vbdotnetforums.com/vb-net-general-discussion/54165-how-correct-redrawing-background-cutted-effect-inside-panel.html#post153014
836  Programación / .NET (C#, VB.NET, ASP) / Una pregunta sobre el autoscroll de un panel en: 23 Noviembre 2012, 19:39 pm
Si por ejemplo mantengo apretado click en el scrollbar y voy bajando el scrollbar con el mouse, ¿Como se hace para que baje progresivamente el panel al ritmo del mouse?

Espero que hayan entendido la pregunta xD
837  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Adjuntar DLL dentro del Executable? en: 23 Noviembre 2012, 15:43 pm
Estoy siguiendo estos pasos:


Citar
   Add the desired assembly (stdlib.dll) to the project's resources.
    Go to the Resources tab of the Project Properties and choose Add Resource > Add Existing File...
    Switch to the Application tab and click on the View Application Events button.

    Add this code to the ApplicationEvents.vb code that opens.

Código
  1.    Private Sub AppStart(ByVal sender As Object,
  2.      ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
  3.        AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf ResolveAssemblies
  4.    End Sub
  5.  
  6.    Private Function ResolveAssemblies(sender As Object, e As System.ResolveEventArgs) As Reflection.Assembly
  7.        Dim desiredAssembly = New Reflection.AssemblyName(e.Name)
  8.  
  9.        If desiredAssembly.Name = "the name of your assembly" Then
  10.            Return Reflection.Assembly.Load(My.Resources.STDLIB) 'replace with your assembly's resource name
  11.        Else
  12.            Return Nothing
  13.        End If
  14.    End Function
  15.  
   Now compile your project and you'll have the dependent assembly incorporated into the output as a single file.

El problema es que lo he hecho todo, pero me da error el "applicationEvents.vb"

Código:
Error	1	Statement is not valid in a namespace.	C:\Users\Administrador\Desktop\WindowsApplication19 - copia - copia\ApplicationEvents.vb	1	1	WindowsApplication19


Mi ApplicationEvents estaba vacío al abrirlo, no se si ese puede ser el error, quizás me falta algo, solo tengo esto :

Código
  1. Private Sub AppStart(ByVal sender As Object,
  2.  ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
  3.    AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf ResolveAssemblies
  4. End Sub
  5.  
  6. Private Function ResolveAssemblies(sender As Object, e As System.ResolveEventArgs) As Reflection.Assembly
  7.    Dim desiredAssembly = New Reflection.AssemblyName(e.Name)
  8.  
  9.    If desiredAssembly.Name = "Ookii.Dialogs.dll" Then
  10.        Return Reflection.Assembly.Load(My.Resources.Ookii.Dialogs) 'replace with your assembly's resource name
  11.    Else
  12.        Return Nothing
  13.    End If
  14. End Function
838  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Como usar un string en la propiedad ROOTFOLDER de un dialogo? en: 23 Noviembre 2012, 14:37 pm
Hola,

Lo que necesito es usar un string, por ejemplo "C:\Carpeta" en la propiedad .RootFolder del FolderBrowserDialog, que usa una enumeración.

He intentado crear mi propia enumeración, pero no lo consigo... algo estaré haciendo mal:

Código
  1. Enum lastfolder
  2.    last = "C:\carpeta"
  3. End Enum

Código
  1.    Public Sub C1Button3_Click(sender As Object, e As EventArgs) Handles folderbutton.Click
  2.        Dim folderselect As New VistaFolderBrowserDialog
  3.        folderselect.RootFolder = lastfolder.last
  4.        folderselect.ShowNewFolderButton = True
  5. ...
  6.    End Sub
839  Programación / .NET (C#, VB.NET, ASP) / (Solucionado) Problema visual con la imagen de fondo del form... en: 22 Noviembre 2012, 17:05 pm
¿Porque pasa esto?


Este es el diseño de la app:



Y esto es lo que sucede si muevo el scroll hacia abajo (o hacia arriba)



La imagen de fondo la usa el form, el panel tiene un "backcolor" transparente, y en fin yo creo que la mezcla de coloresy transparentes y todo eos lo he configurado bien... si necesitan más información al respecto pidanme...



EDITO: He probado lo siguiente, pero solo da resultado si PINCHO en el scroll para moverlo, es decir, si uso la rueda del ratón el evento no se ejecuta...¿Como puedo reproducir este evento para la rueda dle ratón?...

Código:
    Private Sub Panel1_Scroll(sender As Object, e As ScrollEventArgs) Handles Panel1.Scroll
        Me.BackgroundImage = My.Resources.blue_music_2961____copia
    End Sub
End Class
840  Programación / .NET (C#, VB.NET, ASP) / (solucionado) Problemas de acceso en un archivo de texto en: 22 Noviembre 2012, 11:30 am
Tengo problemas al intentar escribir datos en un archivo de texto...

Cualquier ayuda, se agradece!


Las líneas del problema:
Código
  1.            If System.IO.File.Exists(Temp_file) = True Then System.IO.File.Delete(Temp_file)
  2.            System.IO.File.Create(Temp_file)
( Cualquiera de las dos líneas, si elimino una, me da el mismo error en la otra, pero el archivo si que me lo llega a crear (vacío) )

El error:
Código:
The process cannot access the file 'C:\Users\Administrador\AppData\Local\Temp\PlayList_temp.txt' because it is being used by another process.

El sub:
Código
  1.  Public Sub C1Button2_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2.  
  3.        If Not playerargs = Nothing Then
  4.  
  5.            Dim Str As String
  6.            Dim Pattern As String = ControlChars.Quote
  7.            Dim ArgsArray() As String
  8.            Dim Temp_file As String = System.IO.Path.GetTempPath & "\PlayList_temp.txt"
  9.            Dim objWriter As New System.IO.StreamWriter(Temp_file)
  10.  
  11.            Str = Replace(playerargs, " " & ControlChars.Quote, "")
  12.            ArgsArray = Split(Str, Pattern)
  13.  
  14.            If System.IO.File.Exists(Temp_file) = True Then System.IO.File.Delete(Temp_file)
  15.            System.IO.File.Create(Temp_file)
  16.  
  17.        For Each folder In ArgsArray
  18.            If Not folder = Nothing Then
  19.                Dim di As New IO.DirectoryInfo(folder)
  20.                Dim files As IO.FileInfo() = di.GetFiles("*")
  21.                    Dim file As IO.FileInfo
  22.  
  23.                For Each file In files
  24.                    ' command to writleline
  25.                    'Console.WriteLine("File Name: {0}", file.Name)
  26.                    'Console.WriteLine("File Full Name: {0}", file.FullName)
  27.                    objWriter.Write(file.FullName)
  28.                    objWriter.Close()
  29.                Next
  30.            End If
  31.            Next
  32.  
  33.        If randomize.Checked = True Then
  34.                RandomiseFile(Temp_file)
  35.        End If
  36.  
  37.        Process.Start(userSelectedPlayerFilePath, playerargs)
  38.        If autoclose.Checked = True Then
  39.            Me.Close()
  40.        End If
  41.        Else
  42.        MessageBox.Show("You must select at least one folder...", My.Settings.APPName)
  43.        End If
  44.    End Sub




EDITO: Ya está, solucionado:

Código
  1. ....
  2. If Not playerargs = Nothing Then
  3.    ....
  4.    Dim Temp_file As String = System.IO.Path.GetTempPath & "\PlayList_temp.txt"
  5.  
  6.    Using objWriter As New System.IO.StreamWriter(Temp_file, false)
  7.        For Each folder In ArgsArray
  8.            If Not folder = Nothing Then
  9.                Dim di As New IO.DirectoryInfo(folder)
  10.                Dim files As IO.FileInfo() = di.GetFiles("*")
  11.                Dim file As IO.FileInfo
  12.                For Each file In files
  13.                    ' command to writleline
  14.                    'Console.WriteLine("File Name: {0}", file.Name)
  15.                    'Console.WriteLine("File Full Name: {0}", file.FullName)
  16.                    objWriter.Write(file.FullName)
  17.                    ' objWriter.Close()
  18.                Next
  19.            End If
  20.        Next
  21.    End Using ' Flush, close and dispose the objWriter
  22.    ....
Páginas: 1 ... 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 [84] 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ... 105
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines