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


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Temas
Páginas: 1 ... 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 100 101 ... 108
851  Programación / .NET (C#, VB.NET, ASP) / Mi form se cuelga al iniciar un thread... en: 29 Noviembre 2012, 19:36 pm
Para los que no lo sepan, estoy diseñando un programa, y tenía un problema, la app se colgaba al darle al botón "start", hasta que "el proceso" finalizaba no podía tocar nada.
...
...
Después de estar días para conseguir meter una función en un thread separado, ahora que lo he conseguido ...no hay ninguna diferencia... hasta que no finaliza "el proceso" no puedo mover el form por la pantalla, ni pulsar cualquier botón del form, ni nada, solo puedo esperar hasta que acabe...

...Espero alguna ayuda, porqué yo ya no sé que más intentar para que no se me cuelgue, no sé lo que he hecho mal.



Hasta que no se terminan de mostrar todas las líneas del richtextbox no me deja tocar NADA.

...Muchas gracias por leer.




El form:

Código
  1. Imports System.IO
  2. Imports System.Threading
  3. Imports System.Runtime.InteropServices
  4. Imports System.ComponentModel
  5. Imports Ookii.Dialogs
  6.  
  7. Public Class Form1
  8.  
  9. #Region "Declarations"
  10.  
  11.    ' MediaInfo
  12.    Dim MI As MediaInfo
  13.  
  14.    ' Others
  15.    Dim NameOfDirectory As String = Nothing
  16.    Dim aFile As FileInfo
  17.  
  18. #End Region
  19.  
  20. #Region "Properties"
  21. #End Region
  22.  
  23. #Region "Load / Close"
  24.  
  25.    ' Load
  26.    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  27.  
  28.        ' MediaInfo Instance
  29.        MI = New MediaInfo
  30.  
  31.    End Sub
  32.  
  33. #End Region
  34.  
  35. #Region "Get Total files Function"
  36. #End Region
  37.  
  38. #Region "Option checkboxes"
  39. #End Region
  40.  
  41. #Region "Folder buttons"
  42. #End Region
  43.  
  44.  
  45. #Region "Append text function"
  46.  
  47.    ' Append Text
  48.    Public Sub AppendText(box As RichTextBox, color As Color, text As String)
  49.  
  50.        Control.CheckForIllegalCrossThreadCalls = False
  51.  
  52.        Dim start As Integer = box.TextLength
  53.        box.AppendText(text)
  54.        Dim [end] As Integer = box.TextLength
  55.  
  56.        ' Textbox may transform chars, so (end-start) != text.Length
  57.        box.[Select](start, [end] - start)
  58.        If True Then
  59.            box.SelectionColor = color
  60.            ' could set box.SelectionBackColor, box.SelectionFont too.
  61.        End If
  62.        box.SelectionLength = 0
  63.        ' clear
  64.    End Sub
  65.  
  66. #End Region
  67.  
  68.  
  69. #Region "Thread"
  70.  
  71.    Public _WaitHandle_FirstThreadDone As New System.Threading.AutoResetEvent(False)
  72.  
  73.    Public Sub ThreadProc(ByVal aDir As DirectoryInfo)
  74.  
  75.        Dim aFile As FileInfo
  76.  
  77.        For Each aFile In aDir.GetFiles()
  78.  
  79.            If accepted_extensions.ToLower.Contains(aFile.Extension.ToLower) Then
  80.  
  81.                ' print output
  82.                AppendText(consolebox, Color.Yellow, "Processing: ")
  83.                AppendText(consolebox, Color.White, aFile.ToString() + vbNewLine)
  84.                consolebox.ScrollToCaret()
  85.                processedfiles += 1
  86.                totalfiles_label.Text = "Processed " + processedfiles.ToString() + " of " + totalfiles.ToString() + " total video files"
  87.  
  88.                ' Attributes
  89.                If attribs = True Then
  90.                    aFile.Attributes = (aFile.Attributes And Not FileAttributes.ReadOnly And Not FileAttributes.Hidden And Not FileAttributes.System And Not FileAttributes.Archive)
  91.                End If
  92.  
  93.                ' Rename to Word-Case
  94.                If wordcase = True Then
  95.                    Dim renamestr As String = StrConv(aFile.Name, VbStrConv.ProperCase)
  96.                    My.Computer.FileSystem.RenameFile(aFile.FullName, renamestr + "_FILMEN")
  97.                    My.Computer.FileSystem.RenameFile(aFile.FullName + "_FILMEN", renamestr)
  98.                End If
  99.  
  100.                ' Rename to Lower-Case
  101.                If lowercase = True Then
  102.                    Dim renamestr As String = StrConv(aFile.Name, VbStrConv.Lowercase)
  103.                    My.Computer.FileSystem.RenameFile(aFile.FullName, renamestr + "_FILMEN")
  104.                    My.Computer.FileSystem.RenameFile(aFile.FullName + "_FILMEN", renamestr)
  105.                End If
  106.  
  107.                ' Playlists
  108.                If playlist = True Then
  109.                    Using writer As StreamWriter = New StreamWriter(aFile.DirectoryName.ToString() & "\" & aDir.Name & ".m3u", True, System.Text.Encoding.UTF8)
  110.                        writer.WriteLine(aFile.FullName.ToString())
  111.                    End Using
  112.                End If
  113.  
  114.                ' MEDIAINFO:  (ac3, dts, wav and multitrack)
  115.                If ac3 = True Or dts = True Or wav = True Or multitrack = True Then
  116.  
  117.                    MI.Open(aFile.FullName)
  118.  
  119.                    Dim Pos As Integer = 0
  120.                    To_Display = Nothing
  121.  
  122.                    ' multitrack
  123.                    If multitrack = True Then
  124.                        If MI.Count_Get(StreamKind.Audio) > 1 Then
  125.                            results_box.AppendText("Multi Track: " + aFile.FullName.ToString() + vbNewLine)
  126.                            results_box.SelectionStart = results_box.Text.Length
  127.                            results_box.ScrollToCaret()
  128.                            problems += 1
  129.                            problems_label.Text = problems.ToString() + " problems found"
  130.                        End If
  131.                    End If
  132.  
  133.                    While Pos < MI.Count_Get(StreamKind.Audio)
  134.  
  135.                        ' AC-3
  136.                        If ac3 = True Then
  137.                            If MI.Get_(StreamKind.Audio, Pos, "Format").ToString() = "AC-3" Then
  138.                                results_box.AppendText("AC3 Track: " + aFile.FullName.ToString() + vbNewLine)
  139.                                results_box.SelectionStart = results_box.Text.Length
  140.                                results_box.ScrollToCaret()
  141.                                problems += 1
  142.                                problems_label.Text = problems.ToString() + " problems found"
  143.                            End If
  144.                        End If
  145.  
  146.                        ' DTS
  147.                        If dts = True Then
  148.                            If MI.Get_(StreamKind.Audio, Pos, "Format").Contains("DTS") Then
  149.                                results_box.AppendText("DTS Track: " + aFile.FullName.ToString() + vbNewLine)
  150.                                results_box.SelectionStart = results_box.Text.Length
  151.                                results_box.ScrollToCaret()
  152.                                problems += 1
  153.                                problems_label.Text = problems.ToString() + " problems found"
  154.                            End If
  155.                        End If
  156.  
  157.                        ' WAV
  158.                        If wav = True Then
  159.                            If MI.Get_(StreamKind.Audio, Pos, "Format").Contains("PCM") Then
  160.                                results_box.AppendText("WAV Track: " + aFile.FullName.ToString() + vbNewLine)
  161.                                results_box.SelectionStart = results_box.Text.Length
  162.                                results_box.ScrollToCaret()
  163.                                problems += 1
  164.                                problems_label.Text = problems.ToString() + " problems found"
  165.                            End If
  166.                        End If
  167.  
  168.                        System.Math.Max(System.Threading.Interlocked.Increment(Pos), Pos - 1)
  169.                    End While
  170.                End If
  171.  
  172.                If metadata = True Then
  173.                    Dim ffmpeg_process As New Process()
  174.                    Dim ffmpeg_startinfo As New ProcessStartInfo()
  175.                    ffmpeg_startinfo.FileName = "cmd.exe "
  176.                    ffmpeg_startinfo.Arguments = "/C ffmpeg.exe -y -i " & ControlChars.Quote & aFile.FullName.ToString() & ControlChars.Quote & " -f ffmetadata " & ControlChars.Quote & "%TEMP%\" & aFile.Name.ToString() & "_metadata.txt" & ControlChars.Quote & " >NUL 2>&1 && Type " & ControlChars.Quote & "%TEMP%\" & aFile.Name.ToString() & "_metadata.txt" & ControlChars.Quote & "| FINDSTR /I " & ControlChars.Quote & "^INAM ^title" & ControlChars.Quote & " >NUL && Echo FOUND && EXIT || Echo NOT FOUND && Exit"
  177.                    ffmpeg_startinfo.UseShellExecute = False
  178.                    ffmpeg_startinfo.CreateNoWindow = True
  179.                    ffmpeg_startinfo.RedirectStandardOutput = True
  180.                    ffmpeg_startinfo.RedirectStandardError = True
  181.                    ffmpeg_process.EnableRaisingEvents = True
  182.                    ffmpeg_process.StartInfo = ffmpeg_startinfo
  183.                    ffmpeg_process.Start()
  184.                    ffmpeg_process.WaitForExit()
  185.  
  186.                    Dim readerStdOut As IO.StreamReader = ffmpeg_process.StandardOutput
  187.                    Dim FINDstdOut As String = ffmpeg_process.StandardOutput.ReadToEnd
  188.  
  189.                    If FINDstdOut.Contains("FOUND") Then
  190.                        AppendText(consolebox, Color.Red, "TAGS FOUND! Removing tags, please wait..." & vbNewLine)
  191.                        Dim relative_dir As String = aDir.FullName.ToString().Replace(aDir.Root.ToString(), "\")
  192.                        Dim ffmpegconvert_process As New Process()
  193.                        Dim ffmpegconvert_startinfo As New ProcessStartInfo()
  194.                        ffmpegconvert_startinfo.FileName = "cmd.exe "
  195.                        ffmpegconvert_startinfo.Arguments = "/C MKDIR " & ControlChars.Quote & userSelectedFolderPathmetadata & relative_dir & ControlChars.Quote & " 2>NUL & ffmpeg.exe -y -i " & ControlChars.Quote & aFile.FullName.ToString() & ControlChars.Quote & " -c copy -map_metadata -1 " & ControlChars.Quote & userSelectedFolderPathmetadata & relative_dir & "\" & aFile.Name.ToString() & ControlChars.Quote & " >NUL 2>&1 & Exit"
  196.                        ffmpegconvert_startinfo.UseShellExecute = False
  197.                        ffmpegconvert_startinfo.CreateNoWindow = True
  198.                        ffmpegconvert_startinfo.RedirectStandardOutput = True
  199.                        ffmpegconvert_startinfo.RedirectStandardError = True
  200.                        ffmpegconvert_process.EnableRaisingEvents = True
  201.                        ffmpegconvert_process.StartInfo = ffmpegconvert_startinfo
  202.                        ffmpegconvert_process.Start()
  203.                        ffmpegconvert_process.WaitForExit()
  204.                        'Dim ffmpegconvertreaderStdOut As IO.StreamReader = ffmpegconvert_process.StandardOutput
  205.                    End If
  206.  
  207.                    Do While readerStdOut.EndOfStream = False
  208.                        consolebox.AppendText(readerStdOut.ReadLine() + vbNewLine)
  209.                        consolebox.SelectionStart = consolebox.Text.Length
  210.                        consolebox.ScrollToCaret()
  211.                    Loop
  212.  
  213.                End If
  214.            End If
  215.        Next
  216.  
  217.        _WaitHandle_FirstThreadDone.Set()
  218.    End Sub
  219.  
  220.  
  221. #End Region
  222.  
  223.  
  224. #Region "Organize function"
  225.  
  226.    Public Sub MediaInfo(Directory)
  227.        Dim MyDirectory As DirectoryInfo
  228.        MyDirectory = New DirectoryInfo(NameOfDirectory)
  229.        MediaInfoWorkWithDirectory(MyDirectory)
  230.    End Sub
  231.  
  232.    Public Sub MediaInfoWorkWithDirectory(ByVal aDir As DirectoryInfo)
  233.        Dim nextDir As DirectoryInfo
  234.        Dim t As New Threading.Thread(AddressOf ThreadProc)
  235.        t.Start(aDir)
  236.        _WaitHandle_FirstThreadDone.WaitOne()
  237.        For Each nextDir In aDir.GetDirectories
  238.            If playlist = True Then
  239.                Using writer As StreamWriter = New StreamWriter(aDir.FullName & "\" & nextDir.Name & "\" & nextDir.Name & ".m3u", False, System.Text.Encoding.UTF8)
  240.                    'overwrite existing playlist
  241.                End Using
  242.            End If
  243.            MediaInfoWorkWithDirectory(nextDir)
  244.        Next
  245.    End Sub
  246.  
  247. #End Region
  248.  
  249.  
  250. #Region "Action buttons"
  251.  
  252.    ' start button
  253.    Public Sub Button2_Click(sender As Object, e As EventArgs) Handles start_button.Click
  254.  
  255.        If metadata = True And metadatatextbox.Text = "Select a folder to save the converted videos without metadata..." Then
  256.            MsgBox("You must select a folder for the saved metadata videos...", , "Filmen v1.0")
  257.        Else
  258.            If ac3 = False And dts = False And wav = False And multitrack = False And playlist = False And attribs = False And wordcase = False And metadata = False And lowercase = False Then
  259.                MsgBox("You must select at least one option...", , "Filmen v1.0")
  260.            Else
  261.  
  262.                consolebox.Clear()
  263.  
  264.                ' pause / cancel button ON
  265.                pause_button.Enabled = True
  266.                cancel_button.Enabled = True
  267.  
  268.                ' Total files label
  269.                processedfiles = 0
  270.                totalfiles_label.Text = totalfiles.ToString() + " Total video files"
  271.  
  272.                ' Problems label
  273.                problems = 0
  274.                problems_label.Text = "0 problems found"
  275.  
  276.                ' Organization process
  277.                NameOfDirectory = userSelectedFolderPath
  278.                MediaInfo(NameOfDirectory)
  279.                consolebox.AppendText(vbNewLine + "[+] Organization finalized!" + vbNewLine)
  280.                consolebox.Refresh()
  281.                consolebox.SelectionStart = consolebox.Text.Length
  282.                consolebox.ScrollToCaret()
  283.  
  284.                ' pause / cancel button OFF
  285.                pause_button.Enabled = False
  286.                cancel_button.Enabled = False
  287.  
  288.            End If
  289.        End If
  290.    End Sub
  291.  
  292. #End Region
  293.  
  294. End Class
  295.  
852  Programación / .NET (C#, VB.NET, ASP) / [SOURCE] PlayLists en: 29 Noviembre 2012, 18:47 pm
Bueno,
es una caca de programa porqué es el segundo programa que he hecho, y no he conseguido dejar bien la transparencia del programa ni meter la barra de progreso en un thread, pero está decente para usarse y cumple las condiciones necesarias, y me quedo satisfecho al ver la diferencia entre Batch y Winform XD

El programa sirve para seleccionar una o varias carpetas y añadirlas a la lista de reproducción del reproductor multimedia, ni más, ni menos. (Buena tool para bindearla a un "hot-corner" de la pantalla del PC)

     


Source: http://exoshare.com/download.php?uid=EJJTGEXN





Aquí dejo el "boceto" en Batch por si le sirve a alguien:

Código
  1. @echo off
  2. Title Winamp Auto Playlist Menu v0.1
  3.  
  4. :: Auto-redimensionado
  5. color 07
  6. Nircmd win center ititle "Winamp Auto Playlist Menu" >NUL 2>&1
  7. PUSHD "%~dp0"
  8. Set /a Lines=5
  9. Mode con cols=50 lines=%LINES%
  10. For /D %%# in (*) Do (Call Set /A "Lines+=2" & call Mode con cols=60 lines=%%LINES%%)
  11.  
  12. :Menu
  13. CLS
  14. SET "SELECT=" & SET "NUM="
  15. For /D %%# in (*) Do (Call Set /A "Num+=1" & Call Set "Folder%%NUM%%=%%#" & Call Set "List=%%LIST%%!!%%NUM%%" & Call Echo [%%Num%%] %%# | MORE)
  16. Echo [0] * REPRODUCIR TODO * | MORE
  17. Echo: Seleccione una carpeta para reproducirla...
  18. Set /P select=^>^>
  19. Echo "%SELECT%" | FINDSTR /I "[A-Z]" >NUL && (Goto :Menu) || (Echo "%List%" | FIND ";%SELECT% " >NUL || (Goto :Menu))
  20. If "%SELECT%" equ "0" (Goto :todo)
  21.  
  22. :Play
  23. CLS
  24. Call Echo Carpeta seleccionada: "%%Folder%SELECT%%%" | MORE
  25. Call Echo: [+] Iniciando Winamp...
  26. Call Start /B /D "%ProgramFiles(x86)%\Winamp\" winamp.exe "%CD%\%%Folder%SELECT%%%"
  27. Timeout /T 5 & Exit
  28.  
  29. :TODO
  30. CLS
  31. Call Echo Carpeta seleccionada: * TODAS * | MORE
  32. Call Echo: [+] Iniciando Winamp...
  33. For /D %%# in (*) Do (Call Set "ARG=%%arg%% ^"%CD%\%%#^"")
  34. Call Start /B /D "%ProgramFiles(x86)%\Winamp\" winamp.exe %%arg%%
  35. Timeout /T 10 & Exit
853  Programación / .NET (C#, VB.NET, ASP) / (Solucionado) Problema con mi thread... en: 29 Noviembre 2012, 18:05 pm
EDITO: Lo he resuelto creando nuevas instancias del thread dentro del loop

Tengo este thread:

Código
  1. Public Sub ThreadProc(ByVal aDir As DirectoryInfo)
  2.    Dim i As Integer
  3.    For i = 1 To 3
  4.        MsgBox(i)
  5.        Thread.Sleep(500)
  6.    Next
  7.    _WaitHandle_FirstThreadDone.Set()
  8. End Sub
  9.  

Y tengo un búcle que hace esto:

Código
  1.   loop...
  2.    t.Start(aDir)
  3.    _WaitHandle_FirstThreadDone.WaitOne()
  4.   next...

El problema es que solo se ejecuta el thread una sola vez, cuando intenta iniciarse la siguiente vez me dice el debugger: "Subproceso en ejecución o terminado, no se pudo reiniciar",
y no lo entiendo, creo que le estoy indicando al thread que se "setee" como finalizado, y el loop espera a que finalize el thread.. así que no sé donde estará el problema, de verdad no lo entiendo!
854  Programación / .NET (C#, VB.NET, ASP) / (solucionado) Progressbar + label = ¿NO transparencia? en: 28 Noviembre 2012, 18:43 pm
Estoy harto del tema de las transparencias en los winforms...

aver si me podeis ayudar, el problema es sencillo, la solución...no lo sé.

un label "transparente" encima de una barra de progreso:


¿Como puedo hacerlo transparente de verdad?

Gracias...
855  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Cambiar el color de una línea en un richtextbox en: 27 Noviembre 2012, 12:31 pm
Pues eso, ¿Sería posible cambiar el color de UNA sola línea de este richtextbox para que la línea de "Processing: ..." saliera en amarillo por ejemplo?

Y otra pregunta relacionada, ¿Sería posible cambiar solamente UNA palabra de color?

Agradezco cualquier información!

856  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Como agarrar el error-output de un proceso? en: 27 Noviembre 2012, 09:52 am
Hola,

Necesito agarrar el error output de la CMD en este código, pero no sé como hacerlo, solo me agarra el output standard. ¿Me pueden indicar como se hace?

Muchas gracias!

PD: Ya sé que es una mala práctica usar comandos externos, pero no encuentro ninguna librería que sirva para buscar metadataos Y A LA VEZ convertir videos, eso es dificil, estoy aprendiendo!


Código
  1.                If metadata = True Then
  2.                    Dim ffmpeg_process As New Process()
  3.                    Dim ffmpeg_startinfo As New ProcessStartInfo()
  4.                    ffmpeg_startinfo.FileName = "cmd.exe "
  5.                    ffmpeg_startinfo.UseShellExecute = False
  6.                    ffmpeg_startinfo.CreateNoWindow = False
  7.                    ffmpeg_startinfo.Arguments = "/C ffmpeg.exe -y -i " & ControlChars.Quote & aFile.FullName.ToString() & ControlChars.Quote & " -f ffmetadata " & ControlChars.Quote & "%TEMP%\" & aFile.Name.ToString() & "_metadata.txt" & ControlChars.Quote & " >NUL 2>&1 && Type " & ControlChars.Quote & "%TEMP%\" & aFile.Name.ToString() & "_metadata.txt" & ControlChars.Quote & "| FINDSTR /I " & ControlChars.Quote & "^INAM ^title" & ControlChars.Quote
  8.                    ffmpeg_startinfo.RedirectStandardOutput = True
  9.                    ffmpeg_process.EnableRaisingEvents = True
  10.                    ffmpeg_process.StartInfo = ffmpeg_startinfo
  11.                    ffmpeg_process.Start()
  12.                    Dim readerStdOut As IO.StreamReader = ffmpeg_process.StandardOutput
  13.                    Do While readerStdOut.EndOfStream = False
  14.                        consolebox.AppendText(readerStdOut.ReadLine() + vbNewLine)
  15.                        consolebox.SelectionStart = consolebox.Text.Length
  16.                        consolebox.ScrollToCaret()
  17.                    Loop
  18.                End If
857  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.  
858  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...
859  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. "
860  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.
Páginas: 1 ... 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 100 101 ... 108
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines