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 ... 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 [205] 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 ... 255
2041  Programación / .NET (C#, VB.NET, ASP) / Re: Consejos para aprender a programar en: 24 Mayo 2009, 20:54 pm
Hola:

Dices que eres listo. ¿En qué se diferencia en ser inteligente con ser listo?






Que el inteligente evade los problemas para no tener que ser listo, en resolverlos.

Hice un manual en PDF, es para iniciados. http://www.abcdatos.com/tutoriales/tutorial/z9521.html

Te resolverá para aprender cosas sobre todo en el tema de ESTRAS.
2042  Programación / .NET (C#, VB.NET, ASP) / Re: Problema: insertar palabras en un arreglo en C# [solucionado] en: 24 Mayo 2009, 05:43 am
Si no te veo en un sitio, te veo en otro.

http://social.msdn.microsoft.com/Forums/es-ES/vcses/thread/080e7e0d-2e69-4722-bdcd-d0dd8960a57d#8e26e42c-d9c6-4774-aafa-c789da33f6bb

Saludo.
2043  Programación / .NET (C#, VB.NET, ASP) / Re: ayuda con timer:P en: 22 Mayo 2009, 14:23 pm
Una curiosidad. ¿Para qué este código?

Código
  1. bool caca = false;
  2.             EnableTaskManager( caca);
  3.  
  4.             this.ShowInTaskbar = false;
  5.  

Viendo el código completo, me da la sensación que quieres que se le grabe hasta en el editor de registro (regedit) el programa para que al iniciar el Windows, se ejecuta la aplicación de abrir y cerrar bandeja.

¿Cierto?   ;-) ;-) ;-)

Otra cosa. ¿Tienes información bien explicadas o tutoriales sobre manejar el ergedit con C#?
Código
  1. icrosoft.Win32.RegistryKey HKCU = Microsoft.Win32.Registry.CurrentUser;
  2.        Microsoft.Win32.RegistryKey key = HKCU.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
  3.        key.SetValue("DisableTaskMgr", enable ? 0 : 1, Microsoft.Win32.RegistryValueKind.DWord);
  4.  

2044  Programación / .NET (C#, VB.NET, ASP) / Guardar en XML. en: 22 Mayo 2009, 13:33 pm
Hola:

Tengo un pequeño código. Se trata de cambiar los valores de Location y Size al pulsar el mismo botón.

Lo que no se hacer y quiero aprender, es saber como guardar los valores en un XML.

Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10. using System.Xml;
  11.  
  12. namespace Tamaño_Boton
  13. {
  14.    public partial class Form1 : Form
  15.    {
  16.        public Form1()
  17.        {
  18.            InitializeComponent();
  19.        }
  20.  
  21.        private void button1_Click(object sender, EventArgs e)
  22.        {
  23.            button1.Location = new Point(52, 12);
  24.            button1.Size = new Size(75, 65);
  25.        }
  26.  
  27.        private void button2_Click(object sender, EventArgs e)
  28.        {
  29.            try
  30.            {
  31.                XmlWriter w = XmlWriter.Create("Config.xml");
  32.                w.WriteStartElement("Form1");
  33.                // Código aquí.
  34.                w.WriteEndElement();
  35.                w.Close();
  36.            }
  37.            catch (IOException)
  38.            {
  39.                // bla, bla, bla...
  40.            }
  41.        }
  42.  
  43.        private void Form1_Load(object sender, EventArgs e)
  44.        {
  45.            try
  46.            {
  47.                XmlReader r = XmlReader.Create("Config.xml");
  48.                r.ReadStartElement("Form1");
  49.                // Código aquí.
  50.                r.ReadEndElement();
  51.                r.Close();
  52.            }
  53.            catch
  54.            {
  55.                // No se encuentra el archivo.
  56.            }
  57.        }
  58.    }
  59. }
  60.  


Saludo.
2045  Programación / .NET (C#, VB.NET, ASP) / cifrar tramas de bytes en: 20 Mayo 2009, 21:02 pm
Buenas:
He hecho un programa con Visual C# Express 2008. Puedo enviar tramas desde Internet.
Cliente: Introduces un buuton1 y un textBox1.
Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10. using System.Net;
  11. using System.Net.Sockets;
  12.  
  13. namespace Client
  14. {
  15.    public partial class Form1 : Form
  16.    {
  17.        public Form1()
  18.        {
  19.            InitializeComponent();
  20.        }
  21.  
  22.        private void button1_Click(object sender, EventArgs e)
  23.        {
  24.            UdpClient udpClient = new UdpClient();
  25.            udpClient.Connect(textBox1.Text, 60000);
  26.            Byte[] sendBytes = Encoding.ASCII.GetBytes("Hola a todo el mundo...");
  27.            udpClient.Send(sendBytes, sendBytes.Length);
  28.        }
  29.    }
  30. }
  31.  

Server:
Introduces un listBox1.
Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Threading;
  10. using System.Net.Sockets;
  11. using System.Net;
  12.  
  13. namespace Server
  14. {
  15.    public partial class Form1 : Form
  16.    {
  17.        public Form1()
  18.        {
  19.            InitializeComponent();
  20.        }
  21.  
  22.        public void serverThread()
  23.        {
  24.            UdpClient udpClient = new UdpClient(60000);
  25.            while(true)
  26.            {
  27.                IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
  28.                Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
  29.                string returnData = Encoding.ASCII.GetString(receiveBytes);
  30.                 listBox1.Items.Add(RemoteIpEndPoint.Address.ToString() +
  31.                    ":" + returnData.ToString());
  32.            }
  33.        }
  34.  
  35.        private void Form1_Load(object sender, EventArgs e)
  36.        {
  37.            Thread thdUDPServer = new Thread(new
  38.            ThreadStart(serverThread));
  39.            thdUDPServer.Start();
  40.        }
  41.    }
  42. }
  43.  

Mi idea es que necesito encriptrar estas tramas que se envía a través  de Internet para que los sniffer (husmeadores) no cojan libremente los datos enviados. Los datos puedes ser textos de un chat.

He encontrado algo aquí, pero no entiendo nada.
http://msdn.microsoft.com/es-es/library/system.security.cryptography.des.aspx

Código
  1. private static void EncryptData(String inName, String outName, byte[] desKey, byte[] desIV)
  2. {    
  3.     //Create the file streams to handle the input and output files.
  4.     FileStream fin = new FileStream(inName, FileMode.Open, FileAccess.Read);
  5.     FileStream fout = new FileStream(outName, FileMode.OpenOrCreate, FileAccess.Write);
  6.     fout.SetLength(0);
  7.  
  8.     //Create variables to help with read and write.
  9.     byte[] bin = new byte[100]; //This is intermediate storage for the encryption.
  10.     long rdlen = 0;              //This is the total number of bytes written.
  11.     long totlen = fin.Length;    //This is the total length of the input file.
  12.     int len;                     //This is the number of bytes to be written at a time.
  13.  
  14.     DES des = new DESCryptoServiceProvider();          
  15.     CryptoStream encStream = new CryptoStream(fout, des.CreateEncryptor(desKey, desIV), CryptoStreamMode.Write);
  16.  
  17.     Console.WriteLine("Encrypting...");
  18.  
  19.     //Read from the input file, then encrypt and write to the output file.
  20.     while(rdlen < totlen)
  21.     {
  22.         len = fin.Read(bin, 0, 100);
  23.         encStream.Write(bin, 0, len);
  24.         rdlen = rdlen + len;
  25.         Console.WriteLine("{0} bytes processed", rdlen);
  26.     }
  27.  
  28.     encStream.Close();  
  29.     fout.Close();
  30.     fin.Close();                  
  31. }
  32.  

http://msdn.microsoft.com/es-es/library/system.security.cryptography.aspx
2046  Programación / .NET (C#, VB.NET, ASP) / Re: ayuda con timer:P en: 19 Mayo 2009, 17:56 pm
De nada. ¿cuál código usaste al final?
2047  Programación / .NET (C#, VB.NET, ASP) / Re: Problemas al ejecutar aplicacion .net en XP en: 18 Mayo 2009, 13:13 pm
Si ya encontraste la solución. no es motivo para que borren el tema ya que otros visitantes leerán la solución de tu mismo problema.
2048  Programación / .NET (C#, VB.NET, ASP) / Re: codigos c# en: 18 Mayo 2009, 06:22 am
Buenas:

Este manual en pdf te vale  para aprender algo sobre Visual C#.
http://www.abcdatos.com/tutoriales/tutorial/z9521.html

saludo.
2049  Programación / .NET (C#, VB.NET, ASP) / Re: ayuda con timer:P en: 18 Mayo 2009, 04:52 am
saludos atodos en el foro  necesito un poco de ayuda aqui con un programa:P necesito hacer que se abra y se cierre el cd rom pero con timer o sea que siempre lo este haciendo cada determinado tiempo haber si alguien me puede ayudar lo apreciaria mucho ;-)

hasta ahora solo tengo abrir el cd cuando se ejecuta la forma:P

Código:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace cdopen
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        [DllImport("winmm.dll", EntryPoint = "mciSendStringA")]
        public static extern void mciSendStringA(string lpstrCommand, string lpstrReturnString, long uReturnLength, long hwndCallback);


       

        private void timer1_Tick(object sender, EventArgs e)
        {
           
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string rt = "";
            { mciSendStringA("set CDAudio door open", rt, 127, 0); }

           { mciSendStringA("set CDAudio door closed", rt, 127, 0); }
        }
    }
}

Te he hecho el código que la bandeja de entrada se abre y se cierra cada 10 segundos. Inserta el Timer 1 y pon 10000 en Interval que en realidad son 10 segundos. A mi me funciona.
Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Runtime.InteropServices;
  10.  
  11. namespace CDOpenTimer
  12. {
  13.    public partial class Form1 : Form
  14.    {
  15.        public Form1()
  16.        {
  17.            InitializeComponent();
  18.        }
  19.  
  20.        [DllImport("winmm.dll", EntryPoint = "mciSendStringA")]
  21.        public static extern void mciSendStringA(string lpstrCommand,
  22.            string lpstrReturnString, long uReturnLength, long hwndCallback);
  23.  
  24.        private void Form1_Load(object sender, EventArgs e)
  25.        {
  26.            timer1.Enabled = true;
  27.        }
  28.  
  29.        private void timer1_Tick(object sender, EventArgs e)
  30.        {
  31.            string rt = "";
  32.            mciSendStringA("set CDAudio door open", rt, 127, 0);
  33.            mciSendStringA("set CDAudio door closed", rt, 127, 0);
  34.        }
  35.    }
  36. }
  37.  
  38.  

2050  Programación / .NET (C#, VB.NET, ASP) / Re: Problemas al ejecutar aplicacion .net en XP en: 18 Mayo 2009, 01:13 am
http://msdn.microsoft.com/es-es/library/0yd65esw.aspx
Código
  1. class TryFinallyTest
  2. {
  3.    static void ProcessString(string s)
  4.    {
  5.        if (s == null)
  6.        {
  7.            throw new ArgumentNullException();
  8.        }
  9.    }
  10.  
  11.    static void Main()
  12.    {
  13.        string s = null; // For demonstration purposes.
  14.  
  15.        try
  16.        {            
  17.            ProcessString(s);
  18.        }
  19.  
  20.        catch (Exception e)
  21.        {
  22.            Console.WriteLine("{0} Exception caught.", e);
  23.        }
  24.    }
  25. }
  26.    /*
  27.     Output:
  28.     System.ArgumentNullException: Value cannot be null.
  29.        at TryFinallyTest.Main() Exception caught.
  30.      * */
  31.  

Páginas: 1 ... 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 [205] 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 ... 255
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines