Visual C++ Newbie
Mizugori
NYC
Okay I am just starting to try and create some visual programs with C++, I have taken one semester of C++ and I did a 2 week workshop in game programming last summer, but it was a bit of a disappointment. Just so you have some idea as to what skill level I am at. I plan on asking a bunch of questions here as they come up. I am using Microsoft Visual C++ 6.0
I am trying to create a simple application that, when run, opens a window and containg images and buttons. Clicking on these buttons will produce some sort of reaction; perhaps one will close the program, another will open a new window that displays an image, and the third will display a text message. I ran MS Visual C++ 6, and I went to file-new-projects-MFC AppWizard (exe). Then I chose "dialog based," and left all of the other options on their default settings. The first screenshot below shows what resulted. Then, I took a bitmap image and imported it, and added a "picture" slot to my dialog MFC program. I changed the picture slot to type bitmap, and selected the picture I had imported (the gun).
Now I have what you see in the second screenshot. I can compile and build the project, and when I run it, clicking on the buttons (OK and Cancel) simply closes it. Where should I fill in code to make something else happen?
I am trying to create a simple application that, when run, opens a window and containg images and buttons. Clicking on these buttons will produce some sort of reaction; perhaps one will close the program, another will open a new window that displays an image, and the third will display a text message. I ran MS Visual C++ 6, and I went to file-new-projects-MFC AppWizard (exe). Then I chose "dialog based," and left all of the other options on their default settings. The first screenshot below shows what resulted. Then, I took a bitmap image and imported it, and added a "picture" slot to my dialog MFC program. I changed the picture slot to type bitmap, and selected the picture I had imported (the gun).
Now I have what you see in the second screenshot. I can compile and build the project, and when I run it, clicking on the buttons (OK and Cancel) simply closes it. Where should I fill in code to make something else happen?
0
Comments
if (nResponse == IDOK) and if (nResponse == IDCANCEL) ... the IDOK and IDCANCEL are the identifiers given to the buttons ... put your code there.
also, depending on the version of VC++ and the way you set up your class definitions, you will have/have to add code to respond to a click or other event for the picture ...
If this is your first attempt at all this though, MFC might not be the way to go, over time it helps when working on large projects, but for simple tests etc, a win32 based program is easier to tackle from the getgo, if you like i could put together a very simple example of a win32 dialog based app, along with various controls and code to deal with them in various ways ... some of them are not as easy as the others ...
m