Changing the Style of a child control

This is a discussion on Changing the Style of a child control within the Windows Programming forums, part of the Platform Specific Boards category; Below is a quick bit of code which is purely to show were my problem is. Using this exact same ...

  1. #1
    Registered User filler_bunny's Avatar
    Join Date
    Feb 2003
    Posts
    87

    Changing the Style of a child control

    Below is a quick bit of code which is purely to show were my problem is. Using this exact same peice of code, I am able to change the style of the window itself (i.e. remove WS_CAPTION etc) or even a button control, yet no matter how I approach it, I cannot change the styles of a simple edit box. Is there any tricks or am I doing something really very silly here? GetLastError() doesn't give me any info either...
    Code:
    		hwndEdit = CreateWindowEx(0, TEXT("edit"), TEXT(""), WS_CHILD | WS_VISIBLE , 10, 10, 100, 20, hwnd, (HMENU) EDIT_ID, 
    						    	  hInstance, NULL);
    
    		SetWindowLong(hwndEdit, GWL_STYLE, (LONG)GetWindowLong(hwndEdit, GWL_STYLE) | ES_READONLY); 
    		SetWindowPos(hwndEdit, HWND_NOTOPMOST, 10, 40, 100, 50, SWP_NOZORDER);
    Thanks
    Last edited by filler_bunny; 04-28-2004 at 08:32 AM.
    Visual C++ .net
    Windows XP profesional

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Edit Control Styles
    ES_READONLY
    Prevents the user from typing or editing text in the edit control.
    To change this style after the control has been created, use the EM_SETREADONLY message.
    This is useless text to avoid this message:
    >>The message you have entered is too short. Please lengthen your message to at least 4 characters. <<

  3. #3
    Registered User filler_bunny's Avatar
    Join Date
    Feb 2003
    Posts
    87
    Ah...

    Thanks for pointing that out, makes perfect sense.. now.
    Visual C++ .net
    Windows XP profesional

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  2. pipe
    By smart girl in forum C Programming
    Replies: 4
    Last Post: 04-30-2006, 09:17 AM
  3. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 05:23 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21