Dagob
Dagob

Reputation: 745

VC++, making buttons and textboxes an object

At the moment I’m working on a win32 application in Windows. I made a dialog in Visual Studio 2005, I added some check boxes and buttons. In C# + .net the boxes and buttons are an object. That way you can look if they are on or off, change their names and more.

I want the same thing in VC++, but I don't get it to work. At the moment I save the status in the DLGPROC, I look when a button is pressed and I update a variable. But that is not a good way. Can someone tell me how I can do this?

Is there a way to make all the buttons and check boxes an "object"? Or can I use a function to change the name of a static text field and get the status of a field?

Thanks.

Upvotes: 1

Views: 190

Answers (2)

marcinj
marcinj

Reputation: 50036

I am not sure if this is what you are after, but you can think of a HWND as of an "object", all your controls have HWND handle, you can send message to EditBox and get its contents using WM_GETTEXT message, you can also send message WM_SETTEXT to static control to set its text.

Upvotes: 1

arx
arx

Reputation: 16904

Use MFC or WTL or (moving away from Windows-specific stuff) wxWidgets or QT or GTK.

Obviously you could write the code yourself rather than using a library, but providing object wrappers round all of the Windows control functionality is a lot of work.

Upvotes: 2

Related Questions