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


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: 1 ... 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 [933] 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 ... 1254
9321  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 7 Mayo 2013, 14:46 pm
Crear hotkeys globales fuera del form, usando ComboBoxes.

Solo hay que añadir dos comboboxes al form (los valores se añaden al crear la ventana):






Código
  1. #Region " Set Global Hotkeys using ComboBoxes "
  2.  
  3.    ' [ Set Global Hotkeys using ComboBoxes Example ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Instructions :
  8.    ' Instructions:
  9.    ' 1. Add the "GlobalHotkeys Class" Class to the project.
  10.    ' 2. Add a ComboBox in the Form with the name "ComboBox_SpecialKeys", with DropDownStyle property.
  11.    ' 3. Add a ComboBox in the Form with the name "ComboBox_NormalKeys", with DropDownStyle property.
  12.  
  13.    Dim SpecialKeys As String() = {"NONE", "ALT", "CTRL", "SHIFT"}
  14.  
  15.    Dim NormalKeys As String() = { _
  16.    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", _
  17.    "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", _
  18.    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", _
  19.    "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12"}
  20.  
  21.    Dim SpecialKey As String = SpecialKeys(0)
  22.    Dim NormalKey As System.Windows.Forms.Keys
  23.    Dim WithEvents HotKey_Global As Shortcut
  24.  
  25.    ' Form load
  26.    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  27.  
  28.        For Each Item In SpecialKeys
  29.            ComboBox_SpecialKeys.Items.Add(Item)
  30.            Application.DoEvents()
  31.        Next
  32.  
  33.        For Each Item In NormalKeys
  34.            ComboBox_NormalKeys.Items.Add(Item)
  35.            Application.DoEvents()
  36.        Next
  37.  
  38.        ComboBox_SpecialKeys.SelectedItem = SpecialKeys(0)
  39.        ' ComboBox_NormalKeys.SelectedItem = NormalKeys(0)
  40.  
  41.    End Sub
  42.  
  43.    ' ComboBoxes SelectedKeys
  44.    Private Sub ComboBoxes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles _
  45.        ComboBox_SpecialKeys.SelectedIndexChanged, _
  46.        ComboBox_NormalKeys.SelectedIndexChanged
  47.  
  48.        SpecialKey = ComboBox_SpecialKeys.Text
  49.  
  50.        Try : Select Case ComboBox_SpecialKeys.Text
  51.                Case "ALT"
  52.                    NormalKey = [Enum].Parse(GetType(System.Windows.Forms.Keys), ComboBox_NormalKeys.Text, True)
  53.                    HotKey_Global = Shortcut.Create(Shortcut.Modifier.Alt, NormalKey)
  54.                Case "CTRL"
  55.                    NormalKey = [Enum].Parse(GetType(System.Windows.Forms.Keys), ComboBox_NormalKeys.Text, True)
  56.                    HotKey_Global = Shortcut.Create(Shortcut.Modifier.Ctrl, NormalKey)
  57.                Case "SHIFT"
  58.                    NormalKey = [Enum].Parse(GetType(System.Windows.Forms.Keys), ComboBox_NormalKeys.Text, True)
  59.                    HotKey_Global = Shortcut.Create(Shortcut.Modifier.Shift, NormalKey)
  60.                Case "NONE"
  61.                    Dim Number_RegEx As New System.Text.RegularExpressions.Regex("\D")
  62.                    If Number_RegEx.IsMatch(ComboBox_NormalKeys.Text) Then
  63.                        NormalKey = [Enum].Parse(GetType(System.Windows.Forms.Keys), ComboBox_NormalKeys.Text, True)
  64.                    Else
  65.                        NormalKey = [Enum].Parse(GetType(System.Windows.Forms.Keys), (ComboBox_NormalKeys.Text + 96), False)
  66.                    End If
  67.                    HotKey_Global = Shortcut.Create(Shortcut.Modifier.None, NormalKey)
  68.  
  69.            End Select
  70.        Catch : End Try
  71.  
  72.    End Sub
  73.  
  74.    ' Hotkey is pressed
  75.    Private Sub HotKey_Press(ByVal s As Object, ByVal e As Shortcut.HotKeyEventArgs) Handles HotKey_Global.Press
  76.        MsgBox("hotkey clicked: " & SpecialKey & "+" & NormalKey.ToString)
  77.    End Sub
  78.  
  79. #End Region
  80.  
  81. #Region " GlobalHotkeys Class "
  82.  
  83.    Class Shortcut
  84.  
  85.        Inherits NativeWindow
  86.        Implements IDisposable
  87.  
  88.        Protected Declare Function UnregisterHotKey Lib "user32.dll" (ByVal handle As IntPtr, ByVal id As Integer) As Boolean
  89.        Protected Declare Function RegisterHotKey Lib "user32.dll" (ByVal handle As IntPtr, ByVal id As Integer, ByVal modifier As Integer, ByVal vk As Integer) As Boolean
  90.  
  91.        Event Press(ByVal sender As Object, ByVal e As HotKeyEventArgs)
  92.        Protected EventArgs As HotKeyEventArgs, ID As Integer
  93.  
  94.        Enum Modifier As Integer
  95.            None = 0
  96.            Alt = 1
  97.            Ctrl = 2
  98.            Shift = 4
  99.        End Enum
  100.  
  101.        Class HotKeyEventArgs
  102.  
  103.            Inherits EventArgs
  104.            Property Modifier As Shortcut.Modifier
  105.            Property Key As Keys
  106.  
  107.        End Class
  108.  
  109.        Class RegisteredException
  110.  
  111.            Inherits Exception
  112.            Protected Const s As String = "Shortcut combination is in use."
  113.  
  114.            Sub New()
  115.                MyBase.New(s)
  116.            End Sub
  117.  
  118.        End Class
  119.  
  120.        Private disposed As Boolean
  121.  
  122.        Protected Overridable Sub Dispose(ByVal disposing As Boolean)
  123.            If Not disposed Then UnregisterHotKey(Handle, ID)
  124.            disposed = True
  125.        End Sub
  126.  
  127.        Protected Overrides Sub Finalize()
  128.            Dispose(False)
  129.            MyBase.Finalize()
  130.        End Sub
  131.  
  132.        Sub Dispose() Implements IDisposable.Dispose
  133.            Dispose(True)
  134.            GC.SuppressFinalize(Me)
  135.        End Sub
  136.  
  137.        <DebuggerStepperBoundary()>
  138.        Sub New(ByVal modifier As Modifier, ByVal key As Keys)
  139.            CreateHandle(New CreateParams)
  140.            ID = GetHashCode()
  141.            EventArgs = New HotKeyEventArgs With {.Key = key, .Modifier = modifier}
  142.            If Not RegisterHotKey(Handle, ID, modifier, key) Then Throw New RegisteredException
  143.        End Sub
  144.  
  145.        Shared Function Create(ByVal modifier As Modifier, ByVal key As Keys) As Shortcut
  146.            Return New Shortcut(modifier, key)
  147.        End Function
  148.  
  149.        Protected Sub New()
  150.        End Sub
  151.  
  152.        Protected Overrides Sub WndProc(ByRef m As Message)
  153.            Select Case m.Msg
  154.                Case 786
  155.                    RaiseEvent Press(Me, EventArgs)
  156.                Case Else
  157.                    MyBase.WndProc(m)
  158.            End Select
  159.        End Sub
  160.  
  161.    End Class
  162.  
  163. #End Region
9322  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 7 Mayo 2013, 11:53 am
Me he currado esta class para manejar la aplicación ResHacker, para añadir/eliminar/reemplazar/Extraer iconos u otros tipos de recursos de un archivo:

Ejemplos de uso:

Código
  1.         ResHacker.All_Resources_Extract("C:\File.exe", ResHacker.ResourceType.ICON)
  2.         ResHacker.All_Resources_Extract("C:\File.dll", ResHacker.ResourceType.BITMAP, "C:\Temp\")
  3.         ResHacker.MainIcon_Delete("C:\Old.exe", "C:\New.exe")
  4.         ResHacker.MainIcon_Extract("C:\Program.exe", "C:\Icon.ico")
  5.         ResHacker.MainIcon_Replace("C:\Old.exe", "C:\New.exe", "C:\Icon.ico")
  6.         ResHacker.Resource_Add("C:\Old.exe", "C:\New.exe", "C:\Icon.ico", ResHacker.ResourceType.ICON, "Test", 1033)
  7.         ResHacker.Resource_Delete("C:\Old.exe", "C:\New.exe", ResHacker.ResourceType.ICON, "MAINICON", 0)
  8.         ResHacker.Resource_Extract("C:\Old.exe", "C:\New.exe", ResHacker.ResourceType.ICON, "MAINICON", 0)
  9.         ResHacker.Resource_Replace("C:\Old.exe", "C:\New.exe", "C:\Icon.ico", ResHacker.ResourceType.ICON, "MAINICON", 0)
  10.         ResHacker.Run_Script("C:\Reshacker.txt")
  11.         ResHacker.Check_Last_Error()
  12.  
Código
  1. #Region " ResHacker class "
  2.  
  3. Public Class ResHacker
  4.  
  5.    ''' <summary>
  6.    ''' Set the location of ResHacker executable [Default: ".\Reshacker.exe"].
  7.    ''' </summary>
  8.    Public Shared ResHacker_Location As String = ".\ResHacker.exe"
  9.    ''' <summary>
  10.    ''' Set the location of ResHacker log file [Default: ".\Reshacker.log"].
  11.    ''' </summary>
  12.    Public Shared ResHacker_Log_Location As String = ResHacker_Location.Substring(0, ResHacker_Location.Length - 4) & ".log"
  13.  
  14.    ' Most Known ResourceTypes
  15.    ''' <summary>
  16.    ''' The most known ResourceTypes.
  17.    ''' </summary>
  18.    Enum ResourceType
  19.        ASFW
  20.        AVI
  21.        BINARY
  22.        BINDATA
  23.        BITMAP
  24.        CURSOR
  25.        DIALOG
  26.        DXNAVBARSKINS
  27.        FILE
  28.        FONT
  29.        FTR
  30.        GIF
  31.        HTML
  32.        IBC
  33.        ICON
  34.        IMAGE
  35.        JAVACLASS
  36.        JPGTYPE
  37.        LIBRARY
  38.        MASK
  39.        MENU
  40.        MUI
  41.        ORDERSTREAM
  42.        PNG
  43.        RCDATA
  44.        REGINST
  45.        REGISTRY
  46.        STRINGTABLE
  47.        RT_RCDATA
  48.        SHADER
  49.        STYLE_XML
  50.        TYPELIB
  51.        UIFILE
  52.        VCLSTYLE
  53.        WAVE
  54.        WEVT_TEMPLATE
  55.        XML
  56.        XMLWRITE
  57.    End Enum
  58.  
  59.    ' ------------------
  60.    ' MainIcon functions
  61.    ' ------------------
  62.  
  63.    ''' <summary>
  64.    ''' Extract the main icon from file.
  65.    ''' </summary>
  66.    Public Shared Function MainIcon_Extract(ByVal InputFile As String, _
  67.                                         ByVal OutputIcon As String) As Boolean
  68.  
  69.        Try
  70.            Dim ResHacker As New Process()
  71.            Dim ResHacker_Info As New ProcessStartInfo()
  72.  
  73.            ResHacker_Info.FileName = ResHacker_Location
  74.            ResHacker_Info.Arguments = "-extract " & """" & InputFile & """" & ", " & """" & OutputIcon & """" & ", ICONGROUP, MAINICON, 0"
  75.            ResHacker_Info.UseShellExecute = False
  76.            ResHacker.StartInfo = ResHacker_Info
  77.            ResHacker.Start()
  78.            ResHacker.WaitForExit()
  79.  
  80.            Return Check_Last_Error()
  81.  
  82.        Catch ex As Exception
  83.            MsgBox(ex.Message)
  84.            Return False
  85.        End Try
  86.  
  87.    End Function
  88.  
  89.    ''' <summary>
  90.    ''' Delete the main icon of file.
  91.    ''' </summary>
  92.    Public Shared Function MainIcon_Delete(ByVal InputFile As String, _
  93.                                            ByVal OutputFile As String) As Boolean
  94.  
  95.        Try
  96.            Dim ResHacker As New Process()
  97.            Dim ResHacker_Info As New ProcessStartInfo()
  98.  
  99.            ResHacker_Info.FileName = ResHacker_Location
  100.            ResHacker_Info.Arguments = "-delete " & """" & InputFile & """" & ", " & """" & OutputFile & """" & ", ICONGROUP, MAINICON, 0"
  101.            ResHacker_Info.UseShellExecute = False
  102.            ResHacker.StartInfo = ResHacker_Info
  103.            ResHacker.Start()
  104.            ResHacker.WaitForExit()
  105.  
  106.            Return Check_Last_Error()
  107.  
  108.        Catch ex As Exception
  109.            MsgBox(ex.Message)
  110.            Return False
  111.        End Try
  112.  
  113.    End Function
  114.  
  115.    ''' <summary>
  116.    ''' Replace the main icon of file.
  117.    ''' </summary>
  118.    Public Shared Function MainIcon_Replace(ByVal InputFile As String, _
  119.                                        ByVal OutputFile As String, _
  120.                                        ByVal IconFile As String) As Boolean
  121.  
  122.        Try
  123.            Dim ResHacker As New Process()
  124.            Dim ResHacker_Info As New ProcessStartInfo()
  125.  
  126.            ResHacker_Info.FileName = ResHacker_Location
  127.            ResHacker_Info.Arguments = "-addoverwrite " & """" & InputFile & """" & ", " & """" & OutputFile & """" & ", " & """" & IconFile & """" & ", ICONGROUP, MAINICON, 0"
  128.            ResHacker_Info.UseShellExecute = False
  129.            ResHacker.StartInfo = ResHacker_Info
  130.            ResHacker.Start()
  131.            ResHacker.WaitForExit()
  132.  
  133.            Return Check_Last_Error()
  134.  
  135.        Catch ex As Exception
  136.            MsgBox(ex.Message)
  137.            Return False
  138.        End Try
  139.  
  140.    End Function
  141.  
  142.    ' ----------------------
  143.    ' ResourceType functions
  144.    ' ----------------------
  145.  
  146.    ''' <summary>
  147.    ''' Add a resource to file.
  148.    ''' </summary>
  149.    Public Shared Function Resource_Add(ByVal InputFile As String, _
  150.                                        ByVal OutputFile As String, _
  151.                                        ByVal ResourceFile As String, _
  152.                                        ByVal ResourceType As ResourceType, _
  153.                                        ByVal ResourceName As String, _
  154.                                        Optional ByVal LanguageID As Int32 = 0) As Boolean
  155.  
  156.        Try
  157.            Dim ResHacker As New Process()
  158.            Dim ResHacker_Info As New ProcessStartInfo()
  159.  
  160.            ResHacker_Info.FileName = ResHacker_Location
  161.            ResHacker_Info.Arguments = "-add " & """" & InputFile & """" & ", " & """" & OutputFile & """" & ", " & """" & ResourceFile & """" & ", " & ResourceType.ToString & ", " & """" & ResourceName & """" & ", " & LanguageID
  162.            ResHacker_Info.UseShellExecute = False
  163.            ResHacker.StartInfo = ResHacker_Info
  164.            ResHacker.Start()
  165.            ResHacker.WaitForExit()
  166.  
  167.            Return Check_Last_Error()
  168.  
  169.        Catch ex As Exception
  170.            MsgBox(ex.Message)
  171.            Return False
  172.        End Try
  173.  
  174.    End Function
  175.  
  176.    ''' <summary>
  177.    ''' Delete a resource from file.
  178.    ''' </summary>
  179.    Public Shared Function Resource_Delete(ByVal InputFile As String, _
  180.                                    ByVal OutputFile As String, _
  181.                                    ByVal ResourceType As ResourceType, _
  182.                                    ByVal ResourceName As String, _
  183.                                    Optional ByVal LanguageID As Int32 = 0) As Boolean
  184.  
  185.        Try
  186.            Dim ResHacker As New Process()
  187.            Dim ResHacker_Info As New ProcessStartInfo()
  188.  
  189.            ResHacker_Info.FileName = ResHacker_Location
  190.            ResHacker_Info.Arguments = "-delete " & """" & InputFile & """" & ", " & """" & OutputFile & """" & ", " & ResourceType.ToString & ", " & """" & ResourceName & """" & ", " & LanguageID
  191.            ResHacker_Info.UseShellExecute = False
  192.            ResHacker.StartInfo = ResHacker_Info
  193.            ResHacker.Start()
  194.            ResHacker.WaitForExit()
  195.  
  196.            Return Check_Last_Error()
  197.  
  198.        Catch ex As Exception
  199.            MsgBox(ex.Message)
  200.            Return False
  201.        End Try
  202.  
  203.    End Function
  204.  
  205.    ''' <summary>
  206.    ''' Extract a resource from file.
  207.    ''' </summary>
  208.    Public Shared Function Resource_Extract(ByVal InputFile As String, _
  209.                                  ByVal OutputFile As String, _
  210.                                  ByVal ResourceType As ResourceType, _
  211.                                  ByVal ResourceName As String, _
  212.                                  Optional ByVal LanguageID As Int32 = 0) As Boolean
  213.  
  214.        Try
  215.            Dim ResHacker As New Process()
  216.            Dim ResHacker_Info As New ProcessStartInfo()
  217.  
  218.            ResHacker_Info.FileName = ResHacker_Location
  219.            ResHacker_Info.Arguments = "-extract " & """" & InputFile & """" & ", " & """" & OutputFile & """" & ", " & ResourceType.ToString & ", " & """" & ResourceName & """" & ", " & LanguageID
  220.            ResHacker_Info.UseShellExecute = False
  221.            ResHacker.StartInfo = ResHacker_Info
  222.            ResHacker.Start()
  223.            ResHacker.WaitForExit()
  224.  
  225.            Return Check_Last_Error()
  226.  
  227.        Catch ex As Exception
  228.            MsgBox(ex.Message)
  229.            Return False
  230.        End Try
  231.  
  232.    End Function
  233.  
  234.    ''' <summary>
  235.    ''' Replace a resource from file.
  236.    ''' </summary>
  237.    Public Shared Function Resource_Replace(ByVal InputFile As String, _
  238.                              ByVal OutputFile As String, _
  239.                              ByVal ResourceFile As String, _
  240.                              ByVal ResourceType As ResourceType, _
  241.                              ByVal ResourceName As String, _
  242.                              Optional ByVal LanguageID As Int32 = 0) As Boolean
  243.  
  244.        Try
  245.            Dim ResHacker As New Process()
  246.            Dim ResHacker_Info As New ProcessStartInfo()
  247.  
  248.            ResHacker_Info.FileName = ResHacker_Location
  249.            ResHacker_Info.Arguments = "-addoverwrite " & """" & InputFile & """" & ", " & """" & OutputFile & """" & ", " & """" & ResourceFile & """" & ", " & ResourceType.ToString & ", " & """" & ResourceName & """" & ", " & LanguageID
  250.            ResHacker_Info.UseShellExecute = False
  251.            ResHacker.StartInfo = ResHacker_Info
  252.            ResHacker.Start()
  253.            ResHacker.WaitForExit()
  254.  
  255.            Return Check_Last_Error()
  256.  
  257.        Catch ex As Exception
  258.            MsgBox(ex.Message)
  259.            Return False
  260.        End Try
  261.  
  262.    End Function
  263.  
  264.    ' ----------------------
  265.    ' All resources function
  266.    ' ----------------------
  267.  
  268.    ''' <summary>
  269.    ''' Extract all kind of resource from file.
  270.    ''' </summary>
  271.    Public Shared Function All_Resources_Extract(ByVal InputFile As String, _
  272.                                                 ByVal ResourceType As ResourceType, _
  273.                             Optional ByVal OutputDir As String = Nothing) As Boolean
  274.  
  275.        If OutputDir Is Nothing Then
  276.            OutputDir = InputFile.Substring(0, InputFile.LastIndexOf("\")) _
  277.                & "\" _
  278.                & InputFile.Split("\").Last.Substring(0, InputFile.Split("\").Last.LastIndexOf(".")) _
  279.                & ".rc"
  280.        Else
  281.            If OutputDir.EndsWith("\") Then OutputDir = OutputDir.Substring(0, OutputDir.Length - 1)
  282.            OutputDir += "\" & InputFile.Split("\").Last.Substring(0, InputFile.Split("\").Last.LastIndexOf(".")) & ".rc"
  283.        End If
  284.  
  285.        Try
  286.            Dim ResHacker As New Process()
  287.            Dim ResHacker_Info As New ProcessStartInfo()
  288.  
  289.            ResHacker_Info.FileName = ResHacker_Location
  290.            ResHacker_Info.Arguments = "-extract " & """" & InputFile & """" & ", " & """" & OutputDir & """" & ", " & ResourceType.ToString & ",,"
  291.            ResHacker_Info.UseShellExecute = False
  292.            ResHacker.StartInfo = ResHacker_Info
  293.            ResHacker.Start()
  294.            ResHacker.WaitForExit()
  295.  
  296.            Return Check_Last_Error()
  297.  
  298.        Catch ex As Exception
  299.            MsgBox(ex.Message)
  300.            Return False
  301.        End Try
  302.  
  303.    End Function
  304.  
  305.    ' ---------------
  306.    ' Script function
  307.    ' ---------------
  308.  
  309.    ''' <summary>
  310.    ''' Run a ResHacker script file.
  311.    ''' </summary>
  312.    Public Shared Function Run_Script(ByVal ScriptFile As String) As Boolean
  313.  
  314.        Try
  315.            Dim ResHacker As New Process()
  316.            Dim ResHacker_Info As New ProcessStartInfo()
  317.  
  318.            ResHacker_Info.FileName = ResHacker_Location
  319.            ResHacker_Info.Arguments = "-script " & """" & ScriptFile & """"
  320.            ResHacker_Info.UseShellExecute = False
  321.            ResHacker.StartInfo = ResHacker_Info
  322.            ResHacker.Start()
  323.            ResHacker.WaitForExit()
  324.  
  325.            Return Check_Last_Error()
  326.  
  327.        Catch ex As Exception
  328.            MsgBox(ex.Message)
  329.            Return False
  330.        End Try
  331.  
  332.    End Function
  333.  
  334.    ' -------------------------
  335.    ' Check Last Error function
  336.    ' -------------------------
  337.  
  338.    ''' <summary>
  339.    ''' Return the last operation error if any [False = ERROR, True = Ok].
  340.    ''' </summary>
  341.    Shared Function Check_Last_Error()
  342.        Dim Line As String = Nothing
  343.        Dim Text As IO.StreamReader = IO.File.OpenText(ResHacker_Log_Location)
  344.  
  345.        Do Until Text.EndOfStream
  346.            Line = Text.ReadLine()
  347.            If Line.ToString.StartsWith("Error: ") Then
  348.                MsgBox(Line)
  349.                Return False
  350.            End If
  351.        Loop
  352.  
  353.        Text.Close()
  354.        Text.Dispose()
  355.        Return True
  356.  
  357.    End Function
  358.  
  359. End Class
  360.  
  361. #End Region
9323  Media / Multimedia / Re: (consulta) Megui audio desincronizado x264+aac en: 7 Mayo 2013, 11:50 am
¿La supuesta desincronización donde se da?, quiero decir, la notas en el reproductor de video, en el editor de video, o donde?

Te lo comento porque algunos reproductores tienen una mala sincronización (ejemplo: umplayer, smplayer) y te desincronizan sobretodo los videos de 1080p con ms e incluso segundos de diferencia, pero en realidad no están desincronizados.
Si el problema lo notas al reproducir el video te recomiendo que uses el MediaPlayerClassic (Que no es lo mismo que "Mplayer") para salir de dudas y ver si realmente está desincronizado o no.

Aparte, ¿porque no consideras aumentar/disminuir 2-4 frames al framerate del vídeo final para corregir la desincronizacion de 2 segundos?, lo puedes hacer sin reconvertir y es una solución.

Un saludo.
9324  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 5 Mayo 2013, 08:59 am
Para bloquear procesos.

Código
  1. ' [ Block Process Functions ]
  2. '
  3. ' // By Elektro H@cker
  4. '
  5. ' Examples :
  6. ' BlockProcess.Block("cmd") ' Blocks a process
  7. ' BlockProcess.Block("firefox.exe") ' Blocks a process
  8. ' BlockProcess.Unblock("cmd") ' Unblocks a process
  9. ' BlockProcess.Unblock("firefox.exe") ' Unblocks a process
  10. '
  11. ' BlockProcess.Unblock_All() ' Reset all values and stop timer
  12. ' BlockProcess.Monitor_Interval = 5 * 1000
  13. ' BlockProcess.Show_Message_On_Error = True
  14. ' BlockProcess.Show_Message_On_blocking = True
  15. ' BlockProcess.Message_Text = "I blocked your process: "
  16. ' BlockProcess.Message_Title = "Block Process .:: By Elektro H@cker ::."
  17.  
  18. #Region " Block Process Class "
  19.  
  20. Public Class BlockProcess
  21.  
  22.    Shared Blocked_APPS As New List(Of String) ' List of process names
  23.    Shared WithEvents ProcessMon_Timer As New Timer ' App Monitor timer
  24.    ''' <summary>
  25.    ''' Shows a MessageBox if error occurs when blocking the app [Default: False].
  26.    ''' </summary>
  27.    Public Shared Show_Message_On_Error As Boolean = False
  28.    ''' <summary>
  29.    ''' Shows a MessageBox when app is being blocked [Default: False].
  30.    ''' </summary>
  31.    Public Shared Show_Message_On_blocking As Boolean = False
  32.    ''' <summary>
  33.    ''' Set the MessageBox On blocking Text.
  34.    ''' </summary>
  35.    Public Shared Message_Text As String = "Process blocked: "
  36.    ''' <summary>
  37.    ''' Set the MessageBox On blocking Title.
  38.    ''' </summary>
  39.    Public Shared Message_Title As String = "Process Blocked"
  40.    ''' <summary>
  41.    ''' Set the App Monitor interval in milliseconds [Default: 200].
  42.    ''' </summary>
  43.    Public Shared Monitor_Interval As Int64 = 200
  44.  
  45.    ''' <summary>
  46.    ''' Add a process name to the process list.
  47.    ''' </summary>
  48.    Public Shared Sub Block(ByVal ProcessName As String)
  49.        If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
  50.        Blocked_APPS.Add(ProcessName)
  51.        If Not ProcessMon_Timer.Enabled Then ProcessMon_Timer.Enabled = True
  52.    End Sub
  53.  
  54.    ''' <summary>
  55.    ''' Delete a process name from the process list.
  56.    ''' </summary>
  57.    Public Shared Sub Unblock(ByVal ProcessName As String)
  58.        If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
  59.        Blocked_APPS.Remove(ProcessName)
  60.    End Sub
  61.  
  62.    ''' <summary>
  63.    ''' Clear the process list and disables the App Monitor.
  64.    ''' </summary>
  65.    Public Shared Sub Unblock_All()
  66.        ProcessMon_Timer.Enabled = False
  67.        Blocked_APPS.Clear()
  68.    End Sub
  69.  
  70.    ' Timer Tick Event
  71.    Shared Sub ProcessMon_Timer_Tick(sender As Object, e As EventArgs) Handles ProcessMon_Timer.Tick
  72.  
  73.        For Each ProcessName In Blocked_APPS
  74.            Dim proc() As Process = Process.GetProcessesByName(ProcessName)
  75.            Try
  76.                For proc_num As Integer = 0 To proc.Length - 1
  77.                    proc(proc_num).Kill()
  78.                    If Show_Message_On_blocking Then
  79.                        MessageBox.Show(Message_Text & ProcessName & ".exe", Message_Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
  80.                    End If
  81.                Next
  82.            Catch ex As Exception
  83.                If Show_Message_On_Error Then
  84.                    MsgBox(ex.Message) ' One of the processes can't be killed
  85.                End If
  86.            End Try
  87.        Next
  88.  
  89.        ' Set the Timer interval if is different
  90.        If Not sender.Interval = Monitor_Interval Then sender.Interval = Monitor_Interval
  91.  
  92.    End Sub
  93.  
  94. End Class
  95.  
  96. #End Region
9325  Sistemas Operativos / Windows / Re: Windows Update Roto en: 5 Mayo 2013, 08:56 am
Por "version de windows" me refiero a:
Código:
win7 x64 (starter, homeprofessional, ultimate, etc...)
...E incluyendo si tiene ServicePack 1 instalado o no, aunque sincéramente no sé si el servicepack modifica esa DLL que necesitas porque no me voy a poner investigar eso xD, pero por si acaso si tienes win7 x64 con sp1 pues te descargas el win7 x64 con sp1 y así vas a lo seguro...

Ediciones oficiales de Windows 7 con SP1 integrado (Descargas directas aquí)
9326  Programación / Scripting / Re: Un renombrador en batch para imagenes en: 4 Mayo 2013, 18:35 pm
Uf, la de veces que he resuelto esta duda en los foros... xD

Código
  1. @Echo OFF
  2.  
  3. Set "Pattern=*.jpg"
  4. Set "Replace=300x250"
  5.  
  6. For %%# in (
  7. "%Pattern%"
  8. ) Do (
  9. Set "Filename=%%~n#"
  10. Call Set "Filename=%%Filename:%Replace%=%%"
  11. Call Rename "%%#" "%%Filename%%%%~x#"
  12. )
  13.  
  14. Pause&Exit

Saludos.
9327  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 4 Mayo 2013, 18:26 pm
Un snippet para medir el tiempo transcurrido para un procedimiento o una función o cualquier cosa:

MEJORADO:




Código
  1. #Region " Code Execution Time "
  2.  
  3.    ' [ Code Execution Time ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' Execution_Start() : Threading.Thread.Sleep(500) : Execution_End()
  9.  
  10.    Dim Execution_Watcher As New Stopwatch
  11.  
  12.    Private Sub Execution_Start()
  13.        If Execution_Watcher.IsRunning Then Execution_Watcher.Restart()
  14.        Execution_Watcher.Start()
  15.    End Sub
  16.  
  17.    Private Sub Execution_End()
  18.        If Execution_Watcher.IsRunning Then
  19.            MessageBox.Show("Execution watcher finished:" & vbNewLine & vbNewLine & _
  20.                            "[H:M:S:MS]" & vbNewLine & _
  21.                            Execution_Watcher.Elapsed.Hours & _
  22.                            ":" & Execution_Watcher.Elapsed.Minutes & _
  23.                            ":" & Execution_Watcher.Elapsed.Seconds & _
  24.                            ":" & Execution_Watcher.Elapsed.Milliseconds & _
  25.                            vbNewLine & _
  26.                            vbNewLine & _
  27.                            "Total H: " & Execution_Watcher.Elapsed.TotalHours & vbNewLine & vbNewLine & _
  28.                            "Total M: " & Execution_Watcher.Elapsed.TotalMinutes & vbNewLine & vbNewLine & _
  29.                            "Total S: " & Execution_Watcher.Elapsed.TotalSeconds & vbNewLine & vbNewLine & _
  30.                            "Total MS: " & Execution_Watcher.ElapsedMilliseconds & vbNewLine, _
  31.                            "Code execution time", _
  32.                            MessageBoxButtons.OK, _
  33.                            MessageBoxIcon.Information, _
  34.                            MessageBoxDefaultButton.Button1)
  35.            Execution_Watcher.Reset()
  36.        Else
  37.            MessageBox.Show("Execution watcher never started.", _
  38.                            "Code execution time", _
  39.                            MessageBoxButtons.OK, _
  40.                            MessageBoxIcon.Error, _
  41.                            MessageBoxDefaultButton.Button1)
  42.        End If
  43.    End Sub
  44.  
  45. #End Region
9328  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 4 Mayo 2013, 16:44 pm
Elimina el contenido del portapapeles:

Código
  1. Private Sub Delete_Clipboard()
  2.     Clipboard.SetText(vbCr)
  3. End Sub




Devuelve el color de un pixel en varios formatos:

CORREGIDO, si el valor era 0, el formato Hexadecimal devolvía un 0 de menos.

Código
  1. #Region " Get Pixel Color "
  2.  
  3.    ' [ Get Pixel Color Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' Dim RGB As Color = Get_Pixel_Color(MousePosition.X, MousePosition.Y, ColorType.RGB)
  10.    ' MsgBox(Get_Pixel_Color(100, 100, ColorType.RGB).ToString)
  11.    ' MsgBox(Get_Pixel_Color(100, 100, ColorType.HEX))
  12.    ' MsgBox(Get_Pixel_Color(100, 100, ColorType.HTML))
  13.  
  14.    <System.Runtime.InteropServices.DllImport("user32.dll")> Shared Function GetDC(hwnd As IntPtr) As IntPtr
  15.    End Function
  16.  
  17.    <System.Runtime.InteropServices.DllImport("user32.dll")> Shared Function ReleaseDC(hwnd As IntPtr, hdc As IntPtr) As Int32
  18.    End Function
  19.  
  20.    <System.Runtime.InteropServices.DllImport("gdi32.dll")> Shared Function GetPixel(hdc As IntPtr, nXPos As Integer, nYPos As Integer) As UInteger
  21.    End Function
  22.  
  23.    Public Enum ColorType
  24.        RGB
  25.        HEX
  26.        HTML
  27.    End Enum
  28.  
  29.    Public Function Get_Pixel_Color(ByVal x As Int32, ByVal y As Int32, ByVal ColorType As ColorType)
  30.  
  31.        Dim hdc As IntPtr = GetDC(IntPtr.Zero)
  32.        Dim pixel As UInteger = GetPixel(hdc, x, y)
  33.        ReleaseDC(IntPtr.Zero, hdc)
  34.  
  35.        Dim RGB As Color = Color.FromArgb(CType((pixel And &HFF), Integer), CType((pixel And &HFF00), Integer) >> 8, CType((pixel And &HFF0000), Integer) >> 16)
  36.        Dim R As Int16 = RGB.R, G As Int16 = RGB.G, B As Int16 = RGB.B
  37.        Dim HEX_R As String, HEX_G As String, HEX_B As String
  38.  
  39.        Select Case ColorType
  40.            Case ColorType.RGB : Return RGB
  41.            Case ColorType.HEX
  42.                If Hex(R) = Hex(0) Then HEX_R = "00" Else HEX_R = Hex(R)
  43.                If Hex(G) = Hex(0) Then HEX_G = "00" Else HEX_G = Hex(G)
  44.                If Hex(B) = Hex(0) Then HEX_B = "00" Else HEX_B = Hex(B)
  45.                Return (HEX_R & HEX_G & HEX_B)
  46.            Case ColorType.HTML : Return ColorTranslator.ToHtml(RGB)
  47.            Case Else : Return Nothing
  48.        End Select
  49.  
  50.    End Function
  51.  
  52. #End Region




Crear un archivo comprimido autoextraible (SFX) con la librería SevenZipSharp:

Código
  1. #Region " SevenZipSharp Compress SFX "
  2.  
  3.    ' [ SevenZipSharp Compress SFX Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Instructions :
  8.    ' 1. Add a reference to "SevenZipSharp.dll".
  9.    ' 2. Add the "7z.dll" or "7z64.dll" files to the project.
  10.    ' 3. Add the "7z.sfx" and "7zCon.sfx" files to the project.
  11.    ' 4. Use the code below.
  12.    '
  13.    ' Examples :
  14.    ' SevenZipSharp_Compress_SFX("C:\File.txt")                           ' File will be compressed in the same dir.
  15.    ' SevenZipSharp_Compress_SFX("C:\File.txt", "C:\Compressed\File.exe") ' File will be compressed in "C:\Compressed\".
  16.    ' SevenZipSharp_Compress_SFX("C:\Folder\", , , , , , , "Password")    ' Folder will be compressed with the given password.
  17.    ' SevenZipSharp_Compress_SFX("C:\File.txt", , SevenZipSharp_SFX_Module.Console, CompressionLevel.Fast)
  18.  
  19.    ' Imports SevenZip
  20.    ' Dim dll As String = "7z.dll"
  21.  
  22.    Public Enum SevenZipSharp_SFX_Module
  23.        Normal
  24.        Console
  25.    End Enum
  26.  
  27.    Private Function SevenZipSharp_Compress_SFX(ByVal Input_DirOrFile As String, _
  28.                                       Optional ByVal OutputFileName As String = Nothing, _
  29.                                       Optional ByVal SFX_Module As SevenZipSharp_SFX_Module = SevenZipSharp_SFX_Module.Normal, _
  30.                                       Optional ByVal CompressionLevel As CompressionLevel = CompressionLevel.Normal, _
  31.                                       Optional ByVal Password As String = Nothing) As Boolean
  32.        ' Create the .7z file
  33.        Try
  34.            ' Set library path
  35.            SevenZipCompressor.SetLibraryPath(dll)
  36.  
  37.            ' Create compressor
  38.            Dim Compressor As SevenZipCompressor = New SevenZipCompressor()
  39.  
  40.            ' Set compression parameters
  41.            Compressor.CompressionLevel = CompressionLevel ' Archiving compression level.
  42.            Compressor.CompressionMethod = CompressionMethod.Lzma ' Compression Method
  43.            Compressor.ArchiveFormat = OutArchiveFormat.SevenZip ' Compression file format
  44.            Compressor.CompressionMode = CompressionMode.Create ' Append files to compressed file or overwrite the compressed file.
  45.            Compressor.DirectoryStructure = True ' Preserve the directory structure.
  46.            Compressor.IncludeEmptyDirectories = True ' Include empty directories to archives.
  47.            Compressor.ScanOnlyWritable = False ' Compress files only open for writing.
  48.            Compressor.EncryptHeaders = False ' Encrypt 7-Zip archive headers
  49.            Compressor.TempFolderPath = System.IO.Path.GetTempPath() ' Temporary folder path
  50.            Compressor.FastCompression = False ' Compress as fast as possible, without calling events.
  51.            Compressor.PreserveDirectoryRoot = True ' Preserve the directory root for CompressDirectory.
  52.            Compressor.ZipEncryptionMethod = ZipEncryptionMethod.ZipCrypto ' Encryption method for zip archives.
  53.            Compressor.DefaultItemName = "File.7z" ' Item name used when an item to be compressed has no name, for example, when you compress a MemoryStream instance
  54.  
  55.            ' Add Progress Handler
  56.            ' AddHandler Compressor.Compressing, AddressOf SevenZipSharp_Compress_Progress
  57.  
  58.            ' Removes the end slash ("\") if given for a directory
  59.            If Input_DirOrFile.EndsWith("\") Then Input_DirOrFile = Input_DirOrFile.Substring(0, Input_DirOrFile.Length - 1)
  60.  
  61.            ' Generate the OutputFileName if any is given.
  62.            If OutputFileName Is Nothing Then
  63.                OutputFileName = (My.Computer.FileSystem.GetFileInfo(Input_DirOrFile).DirectoryName & "\" & (Input_DirOrFile.Split("\").Last) & ".tmp").Replace("\\", "\")
  64.            Else
  65.                OutputFileName = OutputFileName & ".tmp"
  66.            End If
  67.  
  68.            ' Check if given argument is Dir or File ...then start the compression
  69.            If IO.Directory.Exists(Input_DirOrFile) Then ' Is a Dir
  70.                If Not Password Is Nothing Then
  71.                    Compressor.CompressDirectory(Input_DirOrFile, OutputFileName, True, Password)
  72.                Else
  73.                    Compressor.CompressDirectory(Input_DirOrFile, OutputFileName, True)
  74.                End If
  75.            ElseIf IO.File.Exists(Input_DirOrFile) Then ' Is a File
  76.                If Not Password Is Nothing Then
  77.                    Compressor.CompressFilesEncrypted(OutputFileName, Password, Input_DirOrFile)
  78.                Else
  79.                    Compressor.CompressFiles(OutputFileName, Input_DirOrFile)
  80.                End If
  81.            End If
  82.  
  83.            ' Create the SFX file
  84.            ' Create the SFX compressor
  85.            Dim compressorSFX As SevenZipSfx = New SevenZipSfx(SfxModule.Default)
  86.            ' Set SFX Module path
  87.            If SFX_Module = SevenZipSharp_SFX_Module.Normal Then
  88.                compressorSFX.ModuleFileName = ".\7z.sfx"
  89.            ElseIf SFX_Module = SevenZipSharp_SFX_Module.Console Then
  90.                compressorSFX.ModuleFileName = ".\7zCon.sfx"
  91.            End If
  92.            ' Start the compression
  93.            ' Generate the OutputFileName if any is given.
  94.            Dim SFXOutputFileName As String
  95.            If OutputFileName.ToLower.EndsWith(".exe.tmp") Then
  96.                SFXOutputFileName = OutputFileName.Substring(0, OutputFileName.Length - 4)
  97.            Else
  98.                SFXOutputFileName = OutputFileName.Substring(0, OutputFileName.Length - 4) & ".exe"
  99.            End If
  100.  
  101.            compressorSFX.MakeSfx(OutputFileName, SFXOutputFileName)
  102.            ' Delete the 7z tmp file
  103.            Try : IO.File.Delete(OutputFileName) : Catch : End Try
  104.  
  105.        Catch ex As Exception
  106.            'Return False ' File not compressed
  107.            Throw New Exception(ex.Message)
  108.        End Try
  109.  
  110.        Return True ' File compressed
  111.  
  112.    End Function
  113.  
  114.    ' Public Sub SevenZipSharp_Compress_SFX_Progress(ByVal sender As Object, ByVal e As ProgressEventArgs)
  115.    '     MsgBox("Percent compressed: " & e.PercentDone)
  116.    ' End Sub
  117.  
  118. #End Region
9329  Programación / .NET (C#, VB.NET, ASP) / Re: Error al ejecutar un EXE con C# en: 4 Mayo 2013, 16:19 pm
@Heisenberg_w0rms
Normal que no encuentre el archivo, estás añadiendo los argumentos al nombre de la ruta, los argumentos de la aplicación van separados, a la derecha, no los juntes.

Código
  1. Process.start(Proceso.exe, Argumentos);
Código
  1. Process.start(@dirconversor + "ebook-convert.exe", "prueba.pdf prueba.txt");

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start%28v=vs.71%29.aspx

Saludos
9330  Sistemas Operativos / Windows / Re: Windows Update Roto en: 4 Mayo 2013, 13:57 pm
OMG que desastre de WindowsUpdate xD

A pesar de las indicaciones que te da Songoku y de las indicaciones de tu último comentario... nada de eso te va a servir.

Si dices que el archivo "wucltux.dll.mui" y la dll no se pudieron arreglar y por consiguiente se han eliminado o ha quedado corruptas entonces el error está más que claro, se te han jodido las tablas de idioma.

Este es un recurso de la DLL, que aparece en tu primera imagen:
Código:
<element id="atom(elementModuleHeaderText)" class="wuapp_module_instruction" content="#elementModuleHeaderText#"/>
No puede encontrarla en el archivo MUI.

La solución debería ser tán sencilla como reemplazar los archivos "rotos" por unos funcionales,
¿Y como se hace eso?, pues fácil, te descargas el VirtualBox, instalas TU MISMA VERSION DE WINDOWS, y desde allí te copias los archivos funcionales y los pasas a tu Windows:

wucltux.dll en "C:\windows\system32"
y wucltux.dll.mui en "C:\Windows\system32\Es-es"

Aquí te dejo los de la versión Windows 7 x86 y en inglés, las he sacado de mi VirtualBox, si no te funciona te deberás descargar el Win7 español porque necesitarás el MUI español.
http://www.mediafire.com/?j057kvir3atb58i
El archivo wucltux.dll.mui en "C:\Windows\system32\En-us"

Saludos.

Páginas: 1 ... 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 [933] 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 ... 1254
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines