Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Total beginner asking for pointers

Status
Not open for further replies.

cRaCKh0rN

Programmer
Nov 4, 2005
6
GB
Hi all,
I am using Visual Studio.net. Until now, I have used it primarily for asp.net (vb) web applications. Tonight I decided to install the c++ element and take a look at building a form application. I hope some of you can appreciate that we all have different methods of learning. In my case I simply need a few pointers on how I reference some objects. The tutorials I have found do not really allow me to grasp the fundamentals in the way my brain can absorb.

My questions relate to a new Windows Forms Application. I have added two text boxes and a button in Form1.h the text boxes are name strInputString and strOutputString. I simply wish to know A: How I reference these in Form1.cpp (including syntax.. does the name already create a string for the object etc?) B: The syntax for building an event and function for the click of my button (btnConvert) C: Any additional information I should be aware of.. For example I have seen in C++ tutorials the declaration of a main() function...

I do apologise for my ignorance and I hope that you will understand that if someone can explain these elements to me in this way I can quite happily learn and build from them.

Thanks in advance.
 
Presuming you are using the resouce editing tools to build your dialog, then every time you create an object on the form a #define statement will be added to resources.h which defines the name you gave your object (generally something like "IDC_NAME_COMBOBOX") and assigns it a unique value. That value is used in the resource file (.rc) which is the concrete definition of your doalog box in textual terms, so when in your programming you address IDC_NAME_COMBOBOX it wil affect that control. This int value in turn also can be translated into a window handle (as nearly all controls on a dialog are themselves windows) given the handle of the parent window (the dialog box). These two values are most often used to connect to the control. The .rc file and the resources.h file are established and modified by the resources tools, and the .rc is compiled (it's C code, afterall) to create the structures needed to create your dialogs and all the widgets on them.

The syntax for building an event depends on what packages you are using. In striaght-forward SDK (Petzold) programming, the events will be command messages addressed to your dialog window command handler. In MFC, they will be result in calls on the various "OnWhatever" action routines you build. You control them by sending messages addressed to them.

Anything else you may want to be aware of? Well, that covers a lot of ground. You talk about the main function - certainly there is a relationship there, but you're asking for the kitchen sink, and self-education is the right answer so you can ask specific questions that don't require someone to rewrite Petzold for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top