?
Solved

Changing Window Styles After Creation

Posted on 1998-02-11
3
Medium Priority
?
308 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 100 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

770 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