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
Solved

Changing Window Styles After Creation

Posted on 1998-02-11
3
305 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

856 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