|
8681
|
Programación / .NET (C#, VB.NET, ASP) / Re: Hook global para los Windows Messages?
|
en: 1 Julio 2013, 11:02 am
|
Acabo de descubrir que para enviar un "scroll up/scroll down" se hace con la función SendInput: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspxsi puedes postea tu code para aprender. Public Class Form1 Public Structure Point Public X As Integer Public Y As Integer End Structure Public Structure Msllhookstruct Public Location As Point Public MouseData As Integer Public Flags As Integer Public Time As Integer Public ExtraInfo As Integer End Structure Private Delegate Function HookProc(nCode As Integer, wParam As Integer, ByRef lParam As Msllhookstruct) As Integer <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function SetWindowsHookEx(ByVal hookType As Integer, ByVal lpfn As HookProc, ByVal hMod As IntPtr, ByVal dwThreadId As UInteger) As IntPtr End Function <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function CallNextHookEx(ByVal hhk As IntPtr, ByVal nCode As Integer, ByVal wParam As IntPtr, ByRef lParam As Msllhookstruct) As IntPtr End Function Public Hook As IntPtr Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Hook = SetWindowsHookEx(14, AddressOf Proc, Process.GetCurrentProcess().MainModule.BaseAddress.ToInt32(), 0) End Sub Private Function Proc(nCode As Integer, wParam As Integer, ByRef lParam As Msllhookstruct) As IntPtr If wParam = 522 Then Dim Delta = CShort(lParam.MouseData >> 16) If Delta > 0 Then ' Up MsgBox("Up") ElseIf Delta < 0 Then ' Down MsgBox("Down") End If End If Return CallNextHookEx(Hook, nCode, wParam, lParam) End Function End Class
|
|
|
8682
|
Programación / .NET (C#, VB.NET, ASP) / Necesito iconos de estilo mínimal para reproductor de música
|
en: 1 Julio 2013, 10:13 am
|
Necesito los típicos botones de Play, Pause, Stop, Previous y Next, preferíblemente de estilo mínimal. El problema de buscar estos iconos en google images es que te pueden salir resultados muy variados, por ejemplo un icono azul y otro rosa... ya me entienden. Sé como encontrar este tipo de recursos de manera más eficaz... pero antes de ponerme a revisar las infinitas páginas de DeviantArt y otros sitios pues... me gustaría saber si alguien ha hecho algún proyecto relacionado a reproductores de video/audio y si quiere compartir el pack de iconos que usó en su reproductor... Gracias. Por si no lo entienden, aquí irian los iconos de los botonoes: Saludos. EDITO:Pfff... La verdad es que todos los sets de iconos que encuentro son de pago... y en deviantart y findicons no encuentro nada parecido. Busco algo más o menos como esto:
|
|
|
8683
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 1 Julio 2013, 09:01 am
|
Una Class para controlar WinAmp: http://pastebin.com/4yC91AnDTambién está disponible compilada en un dll: http://sourceforge.net/projects/wacc/PD: Funciona en las versiones 5.X Ejemplos de uso (Aparte de los oficiales): #Region " Examples " ' // By Elektro H@cker ' ' INSTRUCTIONS: ' ' 1. Add a reference for "WACC.DLL" Public Class Form1 Dim Winamp As WACC.clsWACC = New WACC.clsWACC Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ' // Bind the WinAmp process to the variable object Winamp.Bind() ' // Get WinAmp process PID ' Winamp.ProcessID() ' // Close WinAmp ' Winamp.CloseWinamp() ' // Restart WinAmp ' Winamp.RestartWinamp() ' // Open new instance of WinAmp ' Winamp.OpenNewInstance() ' // Play playback ' Winamp.Playback.Play() ' // Pause playback ' Winamp.Playback.PauseUnpause() ' // Stop playback ' Winamp.Playback.Stop() ' // Junp to previous track ' Winamp.Playlist.JumpToPreviousTrack() ' // Junp to next track ' Winamp.Playlist.JumpToNextTrack() ' // Rewind 5 seconds of the current song ' Winamp.Playback.Rewind5s() ' // Forward 5 seconds of the current song ' Winamp.Playback.Forward5s() ' // Get Track Length ' Winamp.Playback.GetTrackLength * 1000 '(ms) ' // Set Track Position ' Winamp.Playback.TrackPosition = 60000 ' (ms) ' // Get WinAmp state ' MsgBox(Winamp.Playback.PlaybackState().ToString) ' If Winamp.Playback.PlaybackState = clsWACC.cPlayback.Playback_State.Playing Then : End If ' // Set volume ' Winamp.AudioControls.Volume = Math.Round(50 / (100 / 255)) ' // Volume up ' Winamp.AudioControls.VolumeUp() ' // Volume down ' Winamp.AudioControls.VolumeDown() ' // Get current track BitRate ' MsgBox(Winamp.Playback.Bitrate.ToString & " kbps") ' // Get current track SampleRate ' MsgBox(Winamp.Playback.SampleRate.ToString & " kHz") ' // Get current track channels ' MsgBox(Winamp.Playback.Channels.ToString & " channels") ' // Clear playlist ' Winamp.Playlist.Clear() ' // Remove missing files in playlist ' Winamp.Playlist.RemoveMissingFiles() ' // Enable/Disable Shuffle ' Winamp.Playback.ShuffleEnabled = True ' // Enable/Disable Repeat ' Winamp.Playback.RepeatEnabled = True ' // Set WinAmp OnTop ' Winamp.Options.AlwaysOnTop = True End Sub End Class #End Region
|
|
|
8684
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 1 Julio 2013, 04:34 am
|
Un AppActivate más sencillo de usar que el default, se puede usar especificando el nombre del proceso. PD: Sirve para activar (darle Focus) a un proceso externo. #Region " App Activate " ' [ App Activate ] ' ' // By Elektro H@cker ' ' Examples : ' ' App_Activate("cmd") ' App_Activate("cmd.exe") ' If App_Activate("cmd") Then... Private Function App_Activate(ByVal ProcessName As String) As Boolean If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4) Dim ProcessArray = Process.GetProcessesByName(ProcessName) If ProcessArray.Length = 0 Then Return False Else AppActivate(ProcessArray(0).Id) Return True End If End Function #End Region
|
|
|
8685
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 30 Junio 2013, 02:18 am
|
lo que voy a postear iría más bien en Scripting.. Estamos en .NET, no en scripting ...¿No?. No es mi trabajo decirte esto pero podrías mandar un privado a uno de los moderadores de esta sección para que te resuelva ese tipo de preguntas, en lugar de volver a spamear este post con preguntas que tienen respuestas obvias... poder puedes postearlo si compensas posteando la parte de .NET, creo que NovLucker pensará igual, somos comprensivos (nos da un poco igual que lo hagas xD), ahora, muy correcto no es hacer eso ...tu mismo. Saludos...
|
|
|
8687
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 29 Junio 2013, 21:20 pm
|
En una aplicación tengo un textbox donde escribo "X" texto y después añado ese texto a un control, pues bien, después de añadir el texto al control, necesito refrescar el texto del Textbox para que se "raisee" el evento OnTextChanged del textbox, pero esto es imposible hacerlo usando Refresh o Invalidate porque lo que actualizan es el drawing del control, no el texto, la única manera es modificando el texto... ...Así que hice este pequeñísimo procedimiento genérico: ' Refresh Textbox Text Private Sub Refresh_Textbox_Text(ByVal TextBox As TextBox) Dim TempText As String = TextBox.Text TextBox.Clear() TextBox.Text = TempText End Sub
Es muy sencilla, pero a alguien le servirá. ' Aquí otra forma: Private Sub textBox1_Invalidated(sender As Object, e As System.Windows.Forms.InvalidateEventArgs) Handles textBox1.Invalidated textBox1_TextChanged(sender, New EventArgs()) End Sub
Saludos.
|
|
|
8688
|
Informática / Software / Re: Hacer portable un programa ya instalado??
|
en: 28 Junio 2013, 21:26 pm
|
El programa es phpDesigner8
En este caso es un programa muy sencillo, no crea ninguna clave de registro (bueno, la crea vacía, asi que nada) Tienes uan carpeta en "%APPDATA%\phpdesigner" Otra carpeta en "%PROGRAMFILES%\phpDesigner 8" ..Y nada más, con copiar eso es suficiente. Saludos!
|
|
|
8689
|
Informática / Software / Re: Hacer portable un programa ya instalado??
|
en: 28 Junio 2013, 21:18 pm
|
...Cada programa es un mundo, si no dices de que programa se trata dudo que se te pueda ayudar más que diciendote esto:
1. Monitoriza el registro en busca de nuevas claves añadidas durante la instalación. 2. Monitoriza los archivos en busca de nuevos archivos expandidos durante la instalación. 3. Recopíla todas esas claves y archivos para crear tu portable.
No me vale lo de "es que ya lo tengo instalado", como ya digo cada programa es un mundo, y ese programa puede tener 1.000 archivos expandidos por las carpetas del sistema y que sin ellos no podrás ejecutar la aplicación, por eso has de monitorizar esos archivos, además puede tener servicios, dll's registradas en el sistema, de todo vaya.
Si dices tener una aplicaicón que ya monitoriza todo eso por ti durante la instalación, pues entonces eso es lo que necesitas.
..Ahora, si se trata de un programa sencillo, pues es suficiente con copiar el contenido del directorio de la aplicación, y hacer tu portable, con Winrar por ejemplo (para newbies).
Saludos!
|
|
|
8690
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 28 Junio 2013, 18:27 pm
|
Un ListView extendido para monitorizar cuando se añade y cuando se elimina un Item. MUY IMPORTANTE: Hay que utilizar los nuevos métodos (AddItem, RemoveItem) en lugar de usar el antiguo ...items.Add o ...items.Remove, para que funcione. PD: Si alguien sabe como overridearlos de forma correcta que lo diga ' /* *\ ' |#* ListView Elektro *#| ' \* */ ' ' // By Elektro H@cker ' ' Properties: ' ........... ' · Disable_Flickering ' · Double_Buffer ' ' Events: ' ....... ' · ItemAdded ' · ItemRemoved ' ' Methods: ' ....... ' · AddItem ' · RemoveItem Public Class ListView_Elektro : Inherits ListView Public Event ItemAdded() Public Event ItemRemoved() Private _Disable_Flickering As Boolean = True Public Sub New() Me.Name = "ListView_Elektro" Me.DoubleBuffered = True ' Me.GridLines = True ' Me.MultiSelect = True ' Me.FullRowSelect = True ' Me.View = View.Details End Sub #Region " Properties " ''' <summary> ''' Enable/Disable any flickering effect on the ListView. ''' </summary> Protected Overrides ReadOnly Property CreateParams() As CreateParams Get If _Disable_Flickering Then Dim cp As CreateParams = MyBase.CreateParams cp.ExStyle = cp.ExStyle Or &H2000000 Return cp Else Return MyBase.CreateParams End If End Get End Property ''' <summary> ''' Set the Double Buffer. ''' </summary> Public Property Double_Buffer() As Boolean Get Return Me.DoubleBuffered End Get Set(ByVal Value As Boolean) Me.DoubleBuffered = Value End Set End Property ''' <summary> ''' Enable/Disable the flickering effects on this ListView. ''' ''' This property turns off any Flicker effect on the ListView ''' ...but also reduces the performance (speed) of the ListView about 30% slower. ''' This don't affect to the performance of the application itself, only to the performance of this control. ''' </summary> Public Property Disable_Flickering() As Boolean Get Return _Disable_Flickering End Get Set(ByVal Value As Boolean) Me._Disable_Flickering = Value End Set End Property #End Region #Region " Methods " ''' <summary> ''' Add an item to the ListView. ''' </summary> Public Function AddItem(ByVal Text As String) As ListViewItem RaiseEvent ItemAdded() Return MyBase.Items.Add(Text) End Function ''' <summary> ''' Remove an item from the ListView. ''' </summary> Public Sub RemoveItem(ByVal Item As ListViewItem) RaiseEvent ItemRemoved() MyBase.Items.Remove(Item) End Sub #End Region End Class
Ejemplo de uso: #Region " [ListView Elektro] Monitor Item added-removed " ' [ListView Elektro] Monitor Item added-removed ' ' // By Elektro H@cker Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Shown Dim Item As ListViewItem = ListView1.AddItem("Test") ' Add the item ListView1.RemoveItem(Item) ' Remove the item End Sub Private Sub ListView_ItemChanged() Handles ListView1.ItemAdded, ListView1.ItemRemoved ' I check if exists at least 1 item inside the ListView If ListView1.Items.Count <> 1 Then MsgBox("Listview have items.") Else MsgBox("Listview is empty.") End Sub #End Region
|
|
|
|
|
|
|