Advertisement Jump to content
Sign in to follow this  

win32 textbox and array quesiton

This topic is 4975 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

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!

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
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



Identifies the dialog box that contains the control.


Specifies the identifier of the control whose title or text is to be retrieved.


Points to the buffer to receive the title or text.


Specifies 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 Values

If 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.


The GetDlgItemText function sends a WM_GETTEXT message to the control.

So implementation should look like:
GetDlgItemText(hDlg, ID_TEXT_EDIT, store, size_of_store);

Share this post

Link to post
Share on other sites
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?


Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!