|
textBox, editBox or whatever you want to call it |
KaBlammyman
Member #455
June 2000
|
Okay, since you guys are 2 for 2 with my recent programming questions, I'll ask you guys again. I got my windows sockets "chat" program running (thanx for the help) now, I want to have the user specify the IP to use so I can easily test my code on remote machines. I plan to do this with an editBox (or is it called a textBox?) All I need is a windows message box with a single line for input, so I can take the string the user enters (should be an IP addy) and connect to the IP. I tied looking for this for a while and MSDN isnt helping, Google sux, and if I see another page on .NET or C#, I'm gonna cut someone. I dont use Vis-C++ 7.0, I sometimes use 6.0 but I mostly use Dev-CPP for my windows programming, and it has done a great job with the API stuff I learned. So, I just want to make a simple textbox so I can enter a string, and then use that string elsewhere in the program. Thanx a lot.
|
Jonatan Hedborg
Member #4,886
July 2004
|
I'm no good at the windows API (or whatever it is), but if you simply want that you could use the command line not quite as easy, but easy enough for testing purposes.
|
LordHolNapul
Member #3,619
June 2003
|
I'm recently programming Visual C++ 6.0 an so... now: #include <string> using namespace std; CString my_cstring; GetDlgItemText( MY_EDIT_BOX_INPUT, my_cstring ); // setDlgItemText is the set method ;) string my_str = my_cstring; // now do what you want when the text into the box change.... For additional questions, I suggest to you this very userfull site: www.codeguru.com Try my game...
|
KaBlammyman
Member #455
June 2000
|
Is there a way to do this in Dev-C++ or in pure code? I know other parts of windows that MFC can do can also be done in pure code, so I'd imagine this wouldnt be any different. I rather not switch to vis-c++ since I started this in dev-c++. thanx.
|
FrankyR
Member #243
April 2000
|
I think what you're looking for is information on working with the win32 api. |
LordHolNapul
Member #3,619
June 2003
|
I know that MFC means Microsoft Foundation Classes, but I don't know if the can be create from a compiler different from Microsoft's. http://www.functionx.com/visualc/ ciao ciao |
KaBlammyman
Member #455
June 2000
|
Thanx for the links guys, but most of them are too basic for me. I have been looking at the CreateWindowEx for making child windows and the options that go along with them, but so far, blindly cutting and pasting code into my win32 stuff doesn't work. ah well...
|
Marco Radaelli
Member #3,028
December 2002
|
Try this
In short it creates a white window with a single line edit box hwndEdit = CreateWindow(TEXT("edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 10, 10, 500, 20, hwnd, (HMENU) ID_EDIT, ((LPCREATESTRUCT) lParam)->hInstance, NULL); (I omitted the style ES_MULTILINE) The relevant code is if(HIWORD(wParam) == EN_UPDATE) { GetWindowText(hwndEdit, szText, 511); InvalidateRect(hwnd, NULL, TRUE); } Which detects when new characters are entered / deleted and updates each time the buffer, plus it forces an update of the entire window.
|
KaBlammyman
Member #455
June 2000
|
Marco, You are the man!! Thanx for the help!
|
Marco Radaelli
Member #3,028
December 2002
|
You're welcome
|
|