Nee help with sending text to child windows

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2005
Posts: 11
Reputation: Demond is an unknown quantity at this point 
Solved Threads: 0
Demond Demond is offline Offline
Newbie Poster

Nee help with sending text to child windows

 
0
  #1
Jan 11th, 2008
How do I send text to a child window? I want to press a button and it sends the text. I am trying to store all of my CD-keys for my games in a program and then send the text to the boxes in the appropriate areas for each game. I have everything done but I can't figure out how to send the key's to the child windows. Can someone give me an example for starcraft, here are the window names and other things I found with Spy++.

Parent Window:
Caption: Starcraft Setup
Class: BlizzardSetup
Style: 1CCA0000

Child Window:
Caption: Starcraft - CD-Key.
Class: #32770 (Dialog)
Style: 94C800C4
Last edited by Demond; Jan 11th, 2008 at 2:02 am.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 88
Reputation: blacklocist is an unknown quantity at this point 
Solved Threads: 2
blacklocist blacklocist is offline Offline
Junior Poster in Training

Re: Nee help with sending text to child windows

 
0
  #2
Jan 18th, 2008
Define all of your games as classes. Then pass the class to your child window and have the child window read the value of the class and display them. Can't do a code sample for you right now.
Forgive my spelling, I spell code not English.
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 11
Reputation: Demond is an unknown quantity at this point 
Solved Threads: 0
Demond Demond is offline Offline
Newbie Poster

Re: Nee help with sending text to child windows

 
0
  #3
Jan 18th, 2008
Ok, thanks for your help I'll try and do what you said.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 88
Reputation: blacklocist is an unknown quantity at this point 
Solved Threads: 2
blacklocist blacklocist is offline Offline
Junior Poster in Training

Re: Nee help with sending text to child windows

 
0
  #4
Jan 18th, 2008
Okay I had time to get some code for you.

First you need to create the class Game or whatever you wish to call it. Feel free to add different properties.

  1. class Game
  2. {
  3. private string strName;
  4. public string Name
  5. {
  6. get
  7. {
  8. return strName;
  9. }
  10. set
  11. {
  12. strName = value;
  13. }
  14. }
  15.  
  16. private string strCaption;
  17. public string Caption
  18. {
  19. get
  20. {
  21. return strCaption;
  22. }
  23. set
  24. {
  25. strCaption = value;
  26. }
  27. }
  28.  
  29. private string strKey;
  30. public string Key
  31. {
  32. get
  33. {
  34. return strKey;
  35. }
  36. set
  37. {
  38. strKey - value;
  39. }
  40. }
  41.  
  42. private int intCDTrayLocation;
  43. public int CDTrayLocation
  44. {
  45. get
  46. {
  47. return intCDTrayLocation;
  48. }
  49. set
  50. {
  51. intCDTrayLocation = value;
  52. }
  53. }
  54.  
  55.  
  56. public Game()
  57. { }
  58.  
  59. public Game(string strName, string strCaption, string strKey, int intCDTrayLocation)
  60. {
  61. this.Name = strName;
  62. this.Caption = strCaption;
  63. this.Key = strKey;
  64. this.CDTrayLocation = intCDTrayLocation;
  65. }
  66. }


Next you need to create the class and then fill the object with data.

  1. Game clssGame = new Game();
  2.  
  3. clssGame.Name = "Starcraft";
  4. clssGame.Caption = "Cool game also cd need to be cleaned";
  5. clssGame.Key = "5555-5555-5555-5555";
  6. clssGame.CDTrayLocation = 22;

After that pass the object Game to the child window. Use some code like this to populate the child window on the load event.

  1. txtbxName.Text = clssGame.Name;
  2. txtbxCaption.Text = clssGame.Caption;

Keep adding different textboxes or whatever control for each property.
Forgive my spelling, I spell code not English.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC