Sign in to follow this  

How to make an Edit box Common control class

This topic is 4397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How to make an Edit box Common control class. I am trying to make a calss for my edit controll but no matter what I do it wont show. Can any one give me any hints on how to do this?

Share this post


Link to post
Share on other sites
Hello,

Here is how you can create an edit control with the Win32 API


HWND EditHWND = CreateWindow("Edit", "Default Text", WS_CHILD | WS_VISIBLE | WS_BORDER, X, Y, Width, Height, ParenthWnd, NULL, hInstance, NULL);



EditHWND = The window handle returned by the CreateWindow function
"Edit" = Specific class for the edit control
"Defaul Text" = If you want the edit control to have default text (can be "")
WS_CHILD | WS_VISIBLE | WS_BORDER = Edit control window style
X = The position X (Left) of the edit control
Y = The position Y (Top) of the edit control
Width = The position width of the edit control
Height = The position height of the edit control
ParenthWnd = The parent dialog window handle
NULL = No menu
hInstance = Handle to the instance of the module to be associated with the window (From WinMain)
NULL = No create structure (lpparam)

Share this post


Link to post
Share on other sites
It's actually EDIT for CreateWindow(), see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/createwindow.asp

You can also use CreateWindowEx().

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike2343
It's actually EDIT for CreateWindow(), see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/createwindow.asp

You can also use CreateWindowEx().


That would only matter if it was case sensetive, but it is not.

edit
EDIT
eDiT
EdIt
EDit
etc. will all work.

Share this post


Link to post
Share on other sites
kingpinz

When you write a wrapper around the common controls, you will need to save out the default WndProc, and use the CallWndProc method to invoke this again when your done with your callback. This is pretty commonly found with all the wrapper tutorials.

What is happening is that the default 'interactivity' for an edit box is only found in its default wndproc, but calling the DefWndProc doesn't access these features. You need to save the default WndProc associated with the edit control, write your own wndproc for the edit control, and then call the edit control's default wndproc

This link should help you with subclassing controls

-brad

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can read one solution to your problem here: http://www.codeproject.com/library/DWinLib.asp. Look at the "Dealing with wrapped child controls" section.

David

Share this post


Link to post
Share on other sites

This topic is 4397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this