Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Dev VC10.0
Hi All,
I have a question regarding Edit control box. It is possible to obtain such control in a child window like it appear in a dialog box? (In a dialog box the edit box has 3d border but in a child window it does not have any visual effect. I want the same edit box also in a child window without using MFC but only Win32 native code).
 
Thanks in advance.
Posted 4-Apr-11 2:13am
raulz79134
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You just need to change the window styles. You can set the styles with the CreateWindow or change them with the SetWindowLong function or SetWindowLongPtr.
 
For example, try this:
 
//get the style
LONG_PTR style = GetWindowLongPtr(hWndEditbox, GWL_STYLE);
//use |= to add a style
style |= WS_BORDER;
//use &= ~(...) to remove a style
style &= ~(WS_BORDER);
//set the new style
SetWindowLongPtr(hWndEditBox, GWL_STYLE, style);
Styles[^]
 
//get the extended style
LONG_PTR exStyle = GetWindowLongPtr(hWndEditbox, GWL_EXSTYLE);
//use |= to add a style
style |= WS_EX_CLIENTEDGE;
//use &= ~(...) to remove a style
style &= ~(WS_EX_CLIENTEDGE);
//set the new style
SetWindowLongPtr(hWndEditBox, GWL_EXSTYLE, exStyle);
Extended styles[^]
 
Try to remove different styles to see which one you don't want.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can do it in this way:
HWND hed;
 
hed = CreateWindowEx
(
	0,
	__TEXT("EDIT"),
	__TEXT(""),
	WS_CHILD|WS_CLIPSIBLINGS|ES_AUTOHSCROLL,
	rcPos.left,
	rcPos.top,
	rcPos.right-rcPos.left,
	rcPos.bottom-rcPos.top,
	hWndParent,
	(HMENU)0,
	(HINSTANCE)0,
	0
);
Use the help manual for the edit control styles (ES_...).
Good luck.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

<>[]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 325
1 Sergey Alexandrovich Kryukov 289
2 CPallini 275
3 DamithSL 260
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 13 Sep 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100