Hello, I am currently programming a Win32 application and I need a "text field" or a "text box" that the user can type in a number to. I will need a few of these so a example would be great.
Hello, I am currently programming a Win32 application and I need a "text field" or a "text box" that the user can type in a number to. I will need a few of these so a example would be great.
Try the windows programming section of the forum.
1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
3. Get rid of conio.h and other antiquated DOS crap headers.
4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.
.. and moved!
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Sorry for posting in the wrong section. I didn't see the Windows programming section..
Use the resource editor to create the Editbox OR use CreateWindowEx() to create one at run time. If you have a lot I suggest the resource editor.
Read the text with GetDlgItemInt() or GetDlgItemText() and atoi().
Check some recent threads for code.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
put this code in the WM_CREATE part of your WndProc. the codeCode:HWND hEdit =CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT", "Type Text Here",WS_CHILD|WS_VISIBLE|WS_HSCROLL|ES_AUTOHSCROLL, 0,0,100,20,hwnd,(HMENU)SOME_KIND_OF_ID,GetModuleHandle(NULL), NULL);
above makes a TextBox at x0 and y0 with a width of 100 and a
height of 20. the SOME_KIND_OF_ID should be defined somewhere
in your program like this:
the WS_HSCROLL and ES_AUTOHSCROLL can be removed (they makeCode:#define SOME_KIND_OF_ID 50
an horizontal scroll bar). 'hwnd' is the window to put this
control on. if any questions, ask please.
Cheers, ComputerWarrior.