How do I send input data from a dialog box to an object?

Hi there!
I am completely new to this place and I am still confused where to post a question and further more - whether this is the exact place for my problem. Please, forgive me if I am wrong.
I am working on a project under .NET's Visual C++ Win32 Application. I am not using Managed Extensions for C++. The program consists of a main window and a dialog, called when the user clicks on a menu from the main window. The dialog appears and then the user inputs data in some edit boxes. How do I elicit the input information from the dialog and send it to a container, that is developed by me. I have created a class, that encapsulates a list of some objects. My aim is creating a pointer to this class(by creating the object dynamically) as a local variable in a function and then using the pointer as a control in order to push data into the list. Well, the problem is that by calling the DialogBoxProcedure, this pointer is no more visible. By clicking, for example, the OK button, the input data must be read and then pushed into the list. Does anybody know how to deal with this problem. Declarating the pointer as a global variable sounds terrible for me :(
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use DialogBoxParam Function instead of DialogBox. This allows to get pointer to this class in WM_INITDIALOG handler. You still need to keep this pointer for using in other message handlers. You can do this using global variable, static DialogBoxProcedure member, class member etc. - according to your program structure.
BTW, when you write Windows application using API, there is no other way except using of global variables. Object-oriented wrappers like MFC or WTL allows to use only class members, but in pure API program data is kept in global variables.
Zdravko_MonovAuthor Commented:
Ok, I see. So, having a global variable in the program does not make things so wrong? I mean, the data is encapsulated in the class quite hard. Unfortunately the global variable is a pointer to the class. This means that by typing "delete GlobalPointer;" my data will be lost. Further more the GlobalPointer is visible from every part of my program. Thus, using the pointer, every module will have access to the data and may modify it in any way. Is there a way to make some methods private and then to give permission to some functions to use them? Can I set the destructor to be a private method, and then in some way declaring that some part of the program can use it?
If you write using API, there is no other choice. API Windows programming is done using global functions, which have access only to parameters passed to them, local and global variables.
In my non-MFC Windows programs I prefer to keep one global structure which keeps all data. At least, this allows to keep only one global variable. This is not pointer, so it cannot be deleted.
If you want to keep program 100% object-oriented, consider using WTL.
There are still some programming areas where C++ is not working for 100%. Non-MFC Windows applications, services, drivers. The reason is that programming interface exposed for developer is C-style. I don't see big problem here.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I think my answer is OK.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.