Jump to content
Xtreme .Net Talk

grip003

Avatar/Signature
  • Posts

    89
  • Joined

  • Last visited

Personal Information

  • .NET Preferred Language
    C#

grip003's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I am trying to capture the CAPS and NUMLOCK keys in an MDI application. I have set the KeyPreview to true and coded the KeyDown event. The problem occurs when a dialog form is being shown. The KeyPreview does not seem to fire when using a dialog form (using ShowDialog()). Is there a way around this without having to add code to every form that is brought up as a dialog form?
  2. I am using the Windows Media Player in a C# application to play video files. It works great, except I don't want the user to be able to double click the control and have it play in full screen mode. I can pick up a double click event and do something with it, but it still moves to full screen mode afterwards. Anyone have any ideas? (I'm using the AxWMPLib.AxWindowsMediaPlayer).
  3. I am also in the same predicament. I am trying to integrate a card swipe system into my existing punch clock software. I want the program to be running in the background, waiting for input to come from someone swiping their magnetic card through the machine. I found something that allows you to run a device through USB that uses a virtual COM port that you can use to interface with. Can input be detected through a COM port as well? I'm sorry this doesn't answer your question, but I am looking for the same solution. It would be much easier, I think, to be able to do the input detection directly through the USB port.
  4. I wrote a simple encryption class to handle encrypting strings and byte arrays. Everything works perfectly in Windows XP and Windows 2000, but I get the following error in Windows 98: Byte array is too large. The maximum size byte array that can be encrypted by this public key implementation is 16 bytes. I am getting this error in the following code public static byte[] RSAEncrypt(byte[] DataToEncrypt, string key_file) { // Encryption is done using the public key. try { System.Windows.Forms.MessageBox.Show("Creating " + "RSACryptoServiceProvider."); // Create a new instance of RSACryptoServiceProvider RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); // Import the RSA Key information, which only needs to // include the public key information. System.IO.FileStream reader = new System.IO.FileStream( key_file, System.IO.FileMode.Open, System.IO.FileAccess.Read); System.Xml.XmlTextReader xml_reader = new System.Xml.XmlTextReader(reader); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(xml_reader); xml_reader.Close(); reader.Close(); RSA.FromXmlString(doc.InnerXml); // By default this will create a 128 bit AES object SymmetricAlgorithm sa = SymmetricAlgorithm.Create(); ICryptoTransform ct = sa.CreateEncryptor(); byte[] encrypt = ct.TransformFinalBlock( DataToEncrypt, 0, DataToEncrypt.Length); RSAPKCS1KeyExchangeFormatter fmt = new RSAPKCS1KeyExchangeFormatter(RSA); byte[] keyex = fmt.CreateKeyExchange(sa.Key); // return the key exchange, the IV (public) and encrypted data byte[] result = new byte [keyex.Length + sa.IV.Length + encrypt.Length]; Buffer.BlockCopy(keyex, 0, result, 0, keyex.Length); Buffer.BlockCopy(sa.IV, 0, result, keyex.Length, sa.IV.Length); Buffer.BlockCopy(encrypt, 0, result, keyex.Length + sa.IV.Length, encrypt.Length); return result; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Exception!!\n" + ex.Message); return null; } }// end RSAEncrypt(byte[] DataToEncrypt, string key_file) The error comes on line byte[] keyex = fmt.CreateKeyExchange(sa.Key); I have I.E. 6.0 installed on the 98 machine, which should include the strong encryption that I need, at least that's what I've heard. Can anyone help me out here?
  5. I am still having problems with this. Can anyone help?
  6. I have created an application that generates files as it is used. I want the uninstall program to completely remove these as well as the rest of the program. Right now, when the user uninstalls my app, it leaves the install directory along with all generated files. Is there a way to remove the entire install directory without worrying about generated files that were not included with the install package? I am using the Setup and Deployment that comes with VS2003.
  7. I'm sorry, I don't know what you mean by Temp-Path settings. Can you get more detailed?
  8. I have been looking through this forum for something dealing with an odd error I am getting. I am getting an Unable to write to stream error when I do a simple INSERT statement into a MySQL database using the .NET connector and ExecuteNonQuery(). The really interesting thing is that I do the exact same thing on a different computer, and it works. This problem has come up only on one computer and it only happens every so often. I can't lock it down. Has this happened to anyone else?
  9. I threw this together, let me know how it compares... DateTime start_time, end_time; long num_primes, loop_max, test; int table_idx; bool is_prime; ResetPrimes(); primesGrid.DataSource = null; start_time = DateTime.Now; try { num_primes = Convert.ToInt64(txtNumPrimes.Text); loop_max = (long)Math.Sqrt(num_primes); for (int i=3; i<=num_primes; i+=2) { loop_max = (long)Math.Sqrt(i); table_idx = 0; test = Convert.ToInt64(prime_tbl.Rows[table_idx][0].ToString()); is_prime = true; while (test <= loop_max) { if (i % test == 0) { // Not a prime is_prime = false; break; } test = Convert.ToInt64(prime_tbl.Rows[++table_idx][0].ToString()); } if (is_prime) { prime_tbl.Rows.Add(new object[] { i } ); } } } catch (Exception ex) { MessageBox.Show("Exception!!\n" + ex.Message + "\nCancelling operation.", "Cancelling Operation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } end_time = DateTime.Now; TimeSpan ts = end_time - start_time; primesGrid.DataSource = prime_tbl; MessageBox.Show(string.Format("Operation took: {0:00}:{1:00}:{2:00}:{3:0000} to " + "complete.", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds), "Operation Finished", MessageBoxButtons.OK, MessageBoxIcon.Information); I have a text box (txtNumPrimes) that you enter the # of primes you want to generate, and the result is in the prime_tbl DataTable (which is connected to the primesGrid.DataSource for viewing the primes). More optimization can be done with the outter loop increment, but this is ok. It runs slower because of the windows form and using a DataTable, but I only had a half hour to play with this.
  10. I looked into using the App.config file, which seems pretty easy. The only problem is that there is no security and someone can just open the file and look at the user name and password information for connecting to the database. Is there a more secure way?
  11. I've never used the app.config file. Can you give me a simple tutorial or link so I can use it?
  12. I write a lot of database applications that connect to a MySQL database. I have a UserProfile class that stores the connection settings into this database as constants, which I know can't be very good. Is there a good way to store connection settings in a program?
  13. Thanks tfowler, that is the way I have been doing this in the past, I was just trying to come up with a slick form that I could use in a general way to perform any loading I wanted to do. According to marble_eater, that is just not possible. Oh well, thanks anyway.
  14. I am using VS2003, and I am trying to open a form in a new thread. What I have done is started a new thread from the main one, and in that thread I create a new form. The new form is used to display some loading results from the main form, but when I show the new form I just get an hourglass and I can't press the cancel button. Here is the simple idea: Show the main form. Start a new thread in the main form for loading. In the new thread, create a 2nd form to display some loading results. While the 2nd form is shown, I want the ability to cancel the loading operation. Does this seem possible?
  15. I spend most of my time programming at work, so I don't get to do much programming for fun. I program database/business applications at work, but I usually program games for fun. I find that I learn a lot more when I am programming for fun, mostly because I don't have to be productive when I am not on a timeline. It gives me the freedom to just try stuff to see how things will work. I then can bring that knowledge back to the office and apply the new stuff to my work applications.
×
×
  • Create New...