Solved

Changing Window Styles After Creation

Posted on 1998-02-11
3
307 Views
Last Modified: 2006-11-17
 Is there an easy way to change the style of a window after it's created?  I've tried to change a TEdit control from ES_LEFT to ES_CENTER using SetStyle() (Borland C++) and SetWindowLong(GWL_STYLE) both with ES_CENTER or'd in.  Neither one changed it.  I tried the same two functions when attempting to remove the WS_HSCROLL from a window.  Again, no change.
0
Comment
Question by:twiley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1181845
To change this style use SetWindowLong with GWL_EXSTYLE.
0
 

Author Comment

by:twiley
ID: 1181846
GWL_EXSTYLE doesn't have any effect on WS_HSCROLL or ES_xxxx.
0
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1181847
You need to redraw the window by calling
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question