Click here to Skip to main content
15,897,334 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Is it possible to add a button on client area in Non-Dialog Based MFCApplication, just like I can draw there a rectangle ?

PS: I am new to C++, MFC and CodeProject so sorry for anything wrong.

EDIT:
Nelek, thanks for link. I managed to create button with CButton class.
But now, as You say, I think that I can do my project based on dialogs as it would be easier to learn the basics.

Pallini, thansk for link, but I think it describes dialog use of buttons (Dialog handles).

PS: Thanks both of You for replies. I see that I have a lot of reading to do.

EDIT: Sorry for the mess. Trying to remove my answer.

EDIT: After 'Addition after OP answer':
Thanks again for suggestions. Will read some more and try this.
Posted
Updated 29-Dec-09 21:50pm
v4

Yes, you can do it, see "Using Buttons"[^] on MSDN.
:)
 
Share this answer
 
Possible it is possible, buttons are CWnd derived so you can use them independantly of Dialogs. The main difference is that you will probably have to do all through code (CFormView can use Editor as well). Dialogs make it much easier with the dialog editor and the wizard.

If you want/need to do it: investigate a bit (here in codeproject, in MSDN [^] or google a bit... you will have a lot of info), make your tests, and ask aboout what you don't understand or the errors you get.

Edit: Underlined text and MSDN link added


Addition after OP answer:
You are welcome.
On the other hand, if you prefer using CView classes you can use CFormView[^] (as I said before in my first edit). This class is "more or less" as a CDialog, but you have a bigger functionality without complicating it so much using the wizard.

It depends on your requirements.

For example:
I would use CDialog to create a new element, getting some concrete data from the user, changing some properties of an object, showing easy things... (processes that you need just temporally or that are "quite local")

But I would use a CFormView to contain the most important and used controls of the application, displaying graphics or more elaborated controls, interacting with other views, printing... (processes that you could need during the whole runtime and/or "globally")
 
Share this answer
 
v4
Nelek, thanks for link. I managed to create button with CButton class.
But now, as You say, I think that I can do my project based on dialogs as it would be easier to learn the basics.

Pallini, thansk for link, but I think it describes dialog use of buttons (Dialog handles).

PS: Thanks both of You for replies. I see that I have a lot of reading to do.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900