win32 textbox and array quesiton

Started by
3 comments, last by Xiachunyi 18 years, 10 months ago
Im trying to make a window with some text boxes where a user can input data and then save it to a file by pushing a button (kind of like a form for a database). How would I go about doing this? Any tutorials for this? Also, Im trying to newly initialize an array and resize it. I was told to use pointers and the new operator, but Im using a custom class and I keep getting an undeclared variable error. This is my code:

resume a*   //resume is my custom class;
a = new resume[5] ;

which gives an a is undeclared. Also how would I resize the array without creating a new array of size+1 and copying all the previous data? and also arethere any good programming IRC channels I can get real time help ? Thanks for all the help!
Advertisement
Is there a semicolon after the declaration? Did you remember to include "resume.h" or wherever the resume class is defined? Thats all I can think of. Unfortunately, no, you cannot resize an array without creating a bigger one and copying everything into it. Finally, gamedev actually has an IRC, although I have never used it.
my siteGenius is 1% inspiration and 99% perspiration
Try using this:
The GetDlgItemText function retrieves the title or text associated with a control in a dialog box. UINT GetDlgItemText(    HWND hDlg,	// handle of dialog box    int nIDDlgItem,	// identifier of control    LPTSTR lpString,	// address of buffer for text    int nMaxCount 	// maximum size of string   );	 ParametershDlgIdentifies the dialog box that contains the control. nIDDlgItemSpecifies the identifier of the control whose title or text is to be retrieved. lpStringPoints to the buffer to receive the title or text. nMaxCountSpecifies the maximum length, in characters, of the string to be copied to the buffer pointed to by lpString. If the length of the string exceeds the limit, the string is truncated.  Return ValuesIf the function succeeds, the return value specifies the number of characters copied to the buffer, not including the terminating null character.If the function fails, the return value is zero. RemarksThe GetDlgItemText function sends a WM_GETTEXT message to the control. 


So implementation should look like:
GetDlgItemText(hDlg, ID_TEXT_EDIT, store, size_of_store);
alright I got my array to work..

im not quite sure how to use your code Xiachunyi. Is there a tutorial or maybe sample code to maybe make a simple window where you can input some text and it saves it to a file?

thanks!
Here is a tutorial for the function I was talking about. The function simply retrieves the the contents of the edit box and stores it into an array. From there, you can do anything to the array you wish, fstream it to a file or manipulate it in some way.

Edit: It does not seem to be C/C++, but the essential logic is the same.

If you need more of a specific elucidation, I can make a simple application later in the evening.

Hope this helps.

This topic is closed to new replies.

Advertisement