How to change Windows Style

This is a discussion on How to change Windows Style within the Windows Programming forums, part of the Platform Specific Boards category; I have a rich edit control on my text editor Window. I want to be able to implement a word ...

  1. #1
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346

    How to change Windows Style

    I have a rich edit control on my text editor Window. I want to be able to implement a word wrap mode for my text editor. I need to be able to change the window style after the window has been created. I took a look at SetWindowLong, but it does not seem to change the window style. I tried changing window by using the SetWindowLong function but it does not seem to work. I was wondering if I had to call another function after this or if this was the correct function to use.

    I tried adding UpdateWindow and ShowWindow afterwards just in case, but it is not working. Does anyone know how to do this?

    Thanks

    - Sean
    Last edited by sean345; 07-29-2002 at 08:34 PM.
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I'm almost certain that you would use SetClassLong() for what you are doing.

  3. #3
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    I could not get that to work either. What I wound up doing is not the best solution, but still works. I copy the text in the window to a buffer, then close the window and create a new edit control with the correct style. Fill it with the text and it works.
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    That isn't pretty...What about sending a EM_SETWORDWRAPMODE?

  5. #5
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Did you call UpdateWindow after changing the style with SetWindowLong? That might work, doubt it though.

  6. #6
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    I did try UpdateWindow. It did not seem to work. The EM_SETWORDBREAKMODE documentation says:
    This message is available only in Asian-language versions of the operating system.
    Thanks anyways.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  7. #7
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Sorry about that, I was pulling that off my head instead of looking at the docs. I know this is possible. Can you post some code. Maybe there is something else wrong.

  8. #8
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    Actually I fixed the problem by destroying the window and creating the new one with the specific window styles. I think this is what notepad does because when there is text present it resets the cursor to the first char no matter where you are just like mine. Thanks for your guy's help.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  9. #9
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Generally, use SetWindowLong to change the style bits (GWL_STYLE flag) then use SetWindowPos to update the window. I think any other fn tends to not work or only partially redraws the changes.

    Hope that helps.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unable to change the windows background color
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 12-29-2007, 01:31 AM
  2. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  3. Change a key in windows?
    By Rouss in forum Tech Board
    Replies: 3
    Last Post: 12-17-2004, 04:24 PM
  4. Codec Bitrates?
    By gvector1 in forum C# Programming
    Replies: 2
    Last Post: 06-16-2003, 09:39 AM
  5. Replies: 2
    Last Post: 09-04-2001, 03:12 PM

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