|
9191
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 20 Abril 2013, 06:02 am
|
· Usar un proxy en el WebBrowser: #Region " Use Proxy " ' [ Use Proxy ] ' ' Examples : ' Use_Proxy("213.181.73.145:80") ' WebBrowser1.Navigate("http://www.ipchicken.com/") <Runtime.InteropServices.DllImport("wininet.dll", SetLastError:=True)> _ Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLength As Integer) As Boolean End Function Public Structure Struct_INTERNET_PROXY_INFO Public dwAccessType As Integer Public proxy As IntPtr Public proxyBypass As IntPtr End Structure Private Sub Use_Proxy(ByVal strProxy As String) Const INTERNET_OPTION_PROXY As Integer = 38 Const INTERNET_OPEN_TYPE_PROXY As Integer = 3 Dim struct_IPI As Struct_INTERNET_PROXY_INFO struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy) struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local") Dim intptrStruct As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI)) Marshal.StructureToPtr(struct_IPI, intptrStruct, True) Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI)) End Sub #End Region
|
|
|
9193
|
Programación / Scripting / Re: script para abrir una página web dependiendo del día se la semana
|
en: 20 Abril 2013, 01:50 am
|
puede ir sacando el dia de la semana segun la fecha y guardarlo, ¿No? Sería un poco de lio con los dias de cada mes, y aun mas si cuentas los años bisiestos, pero supongo que tambien se podria hacer, creo. Exacto, demasiado lío por todo lo que has comentado, por eso lo que dije de " hay que pensar más (en Batch)", para hacer eso hay que ser un gurú de los calendarios xD, como Rob Van Der Woude: http://www.robvanderwoude.com/datetime.phpPoder se puede hacer, pero en fín, no vale la pena usar tanto código y comerse la cabeza experimentando, teniendo las classes de WMI... Saludos!
|
|
|
9195
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 19 Abril 2013, 22:35 pm
|
· comprueba si Aero está activado: #Region " Is Aero Enabled? " ' [ Is Aero Enabled? Function ] ' ' Examples: ' MsgBox(Is_Aero_Enabled) <System.Runtime.InteropServices.DllImport("dwmapi.dll")> _ Private Shared Function DwmIsCompositionEnabled(ByRef enabled As Boolean) As Integer End Function Public Function Is_Aero_Enabled() As Boolean If Environment.OSVersion.Version.Major < 6 Then Return False ' Windows version is under Windows Vista so not Aero. Else DwmIsCompositionEnabled(Is_Aero_Enabled) End If End Function #End Region
|
|
|
9197
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 19 Abril 2013, 19:34 pm
|
· Un Sub especial para el control de terceros "CButton", para modificar los colores (Y actualizar el estado de los colores). http://www.codeproject.com/Articles/26622/Custom-Button-Control-with-Gradient-Colors-and-Ext#Region " Change Cbutton Color " ' [ Change Cbutton Color ] ' ' // By Elektro H@cker ' ' Examples: ' Change_Cbutton_Color(CButton1, Color.Black, Color.DarkRed, Color.Red) Private Sub Change_Cbutton_Color(ByVal Button_Name As CButtonLib.CButton, _ ByVal Color1 As Color, _ ByVal Color2 As Color, _ ByVal Color3 As Color) Button_Name.ColorFillBlend.iColor(0) = Color1 Button_Name.ColorFillBlend.iColor(1) = Color2 Button_Name.ColorFillBlend.iColor(2) = Color3 Button_Name.UpdateDimBlends() End Sub #End Region
|
|
|
9198
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 19 Abril 2013, 18:47 pm
|
· Setear los argumentos commandline por defecto del modo debug de la aplicación. #Region " Set CommandLine Arguments " ' [ Set CommandLine Arguments Function ] ' ' // By Elektro H@cker ' ' Examples: ' For Each Arg In Arguments : MsgBox(Arg) : Next Dim Arguments As List(Of String) = Set_CommandLine_Arguments() Public Function Set_CommandLine_Arguments() As List(Of String) ' Debug Commandline arguments for this application: Dim DebugArguments = "Notepad.exe -Sleep 5 -Interval 50 -Key CTRL+C" Return DebugArguments.Split(" ").ToList #Else ' Nomal Commandline arguments Return My.Application.CommandLineArgs.ToList #End If End Function #End Region
|
|
|
9199
|
Programación / Scripting / Re: Aprender algún lenguaje de Scripting
|
en: 19 Abril 2013, 17:58 pm
|
Me permites la pregunta de... ¿Porque sabiendo dos lenguajes compilados, quieres aprender uno interpretado?, ¿No sería mejor para tí que profundizases en JAVA/C++?
Bueno, de todas formas, Ruby está al nivel de Python, y en mi opinión es más sencillo de aprender y usar.
Un saludo!
|
|
|
9200
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 19 Abril 2013, 17:42 pm
|
· Ejemplo de un String multi-línea para aplicaciones de consola: Dim Logo As String = <a><![CDATA[ ___ _ _ _ _ _____ _ _ _ / _ \ | (_) | | (_) |_ _(_) | | | / /_\ \_ __ _ __ | |_ ___ __ _| |_ _ ___ _ __ | | _| |_| | ___ | _ | '_ \| '_ \| | |/ __/ _` | __| |/ _ \| '_ \ | | | | __| |/ _ \ | | | | |_) | |_) | | | (_| (_| | |_| | (_) | | | | | | | | |_| | __/ \_| |_/ .__/| .__/|_|_|\___\__,_|\__|_|\___/|_| |_| \_/ |_|\__|_|\___| | | | | |_| |_| ]]></a>.Value Console.WriteLine(Logo)
|
|
|
|
|
|
|