Dear DANIWEB community members,

I am a newbie with Windoze programming, and I hope you could help me going with my project as I have a really just a technical question:

I have a simple GUI with some buttons and text boxes defined in a form .h file, and I have some custom functions that run in Main() in the .cpp file. Amongst the other stuff, my functions return various status messages like 'Socket initialized, IP<blah>:<blah>' and error codes...

I have the non-editable text box in which I would like to display all that stuff, but apparently I cannot get to it from main()!!! This is most odd experience: I have the header included, the form's class and its members (all those boxed) defined in the included header.. and I cannot seemingly use it!

For now, I have to run my functions inside the event handlers which I think is not a very nice and structured way to do it. Besides, the other stuff that my functions return is rather useful and it does not get passed beyond the scope... I really would like to make use of main()... so how do I communicate with the TextBox (and with other controls for that matter) in the form from main()?

Thank you so much, and I'd really be grateful to someone taking a couple of minutes of their time to get me going!


I know there got to be some method like GetObjectByName() or something? Microsoft's Documentation is really bad: it looks like they got lost in some of their stuff by now and barely generate the class descriptions via scripts... and use it for help...

I'm assuming this is a non-managed program, not Windows Forms which is managed cli/c++.

Why don't you call win32 api MessageBox(), which can be called from main().

main() can use the other windows controls providing it knows about the window's HWND handle.

Edited 6 Years Ago by Ancient Dragon: n/a

Well... a message box is a message box: it's in a separate little window, and it displays just one message at a time. I would like to be able to see the history and what's gonna go wrong with the device etc.
My proggy looks like this so far, and all communication aspects have been handled: I just rule that power supply from the command line... but people wantz windowz and buttonz...

Attachments screen001.png 35.98 KB

Dear Ancient Dragon,

Thank you! I see what you say now, and I will try... however it keeps bothering me that there is some pretty and simple way to communicate among the various controls. This experiment will take some time now, as I am a newbie.

This article has been dead for over six months. Start a new discussion instead.