Thread: Somethings wrong...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    6

    Somethings wrong...

    Hey, wondered if someone could give me a bit of wisdom as to why my program compiles fine but crashes during use.

    Its just a simple program with two edit controls. I enter text into edit control A and press the "submit" button and it reappears in edit control B. This works fine for string lengths up to 10 characters...why doesn't it work for longer strings?

    It either stops responding, or just closes.

    Code:
     
             switch (wParam)                      
                 {                          
                      case SUBMIT:
                                  {
                                  LPSTR text;
                                  DWORD nochars =GetWindowTextLength(EntryBoxA);
                                  if (nochars != NULL) 
                                     {
                                          GetWindowText(EntryBoxA, text,nochars+1);
                                          SetWindowText(EntryBoxB, text);                                  }
                                  else
                                     {
                                          MessageBox(hwnd, "No Window Text Length!", "None", MB_OK | MB_ICONINFORMATION);
                                     }
                                 } 
                                 break;
                       default:
                                 break;
                          }
    Last edited by dootickle; 04-15-2004 at 11:29 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  2. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  3. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  4. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM
  5. I think somethings wrong
    By Unregistered in forum C Programming
    Replies: 9
    Last Post: 06-10-2002, 05:28 PM