i need to create edit box in c++ without using mfc.....
only win32
views:
47answers:
2
+2
A:
CreateWindow("EDIT", ...);
. You can use CreateWindowEx
if you prefer, but it's not necessary. To use it, you'll also normally want to have your window respond to WM_FOCUS
by calling SetFocus
to set the focus on the edit control. You'll typically also want to respond to WM_MOVE
(or is it WM_SIZE
- I can't remember) by resizing the edit control to fit the client area of the parent window.
Of course you can also create a dialog (DialogBox
or DialogBoxEx
) containing an edit control. This avoids having to manually set the focus and such.
Jerry Coffin
2010-09-22 22:08:31
+1
A:
HWND CreateTextBox(CONST INT iX, CONST INT iY, CONST UINT uWidth, CONST UINT uHeight, HWND hWnd, CONST UINT uId, HINSTANCE hInstance)
{
HWND hWndRet = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("Edit"), NULL, WS_CHILD, iX, iY, (signed)uWidth, (signed)uHeight, hWnd, (HMENU)uId, hInstance, NULL);
SetBkColor(GetDC(hWndRet), RGB(255, 255, 255));
return hWndRet;
}
Just a small function I use for creating default, blank text boxes.
myeviltacos
2010-09-22 22:51:15
i really like the function you posted but what does uId stand for like what is it for?
Ramiz Toma
2010-09-23 02:57:20
uId is the Id of the control. When you create a control in Win32, it has an identifier which is used in your WndProc.If you don't understand what I mean, open the VS resource editor, add a dialog, dump some controls onto the dialog, and take a look at the Ids of the controls.
myeviltacos
2010-09-24 03:07:47