Advertisement

Oh god I need help

Started by August 12, 2000 11:46 PM
1 comment, last by ManaStone 24 years, 5 months ago
I''m reading this book called Practical Visual C++. One of the Authors is good, but the other one is absolutely horrible and I don''t understand what he is doing. On chapter 10 he starts talking about making dialog boxes, He doesn''t even tell you what your supposed to name your things, then when he adds code to classes, you don''t know which classes he is talking about. Anyway... here is the problem: Please help me figure out which name is for what object. I made a new Dialog class named IDD_MYNEWDLG. I then selected it from resource view pane then used the class wizard. It gave me the warning message saying that I need to add a new class for the dialog. I named the class CMyNewDlg (like I was supposed to), but it said I should change the default header and implementation file(though it doesn''t say what to). Then it said I should add this code to the handler function to create an instance of a dialog class: CMyCustomDlg DlgMyCustom(this); But where did the CMyCustomDlg come from? And later it said this " If your new dialg class definition resides in the MyCustomDlg.h and you are adding the instantiating line that references the new dialog class definition to the CustomDlg.cpp implementation file, you should add the following line to the top of CustomDlg.cpp: #include "MyCustomDlg.h" So right now I''m kind of thinking that I was supposed to name the dialog project Custom, and change the header and implementation file of the class CMyNewDialog name to MyCustomDlg. But still where would the CMyCustomDlg class come from? The only thing I can think of is that it is apart the the MFC library. I would be very greatful for any help.
-----------------------------Download my real time 3D RPG.
Okay CMyCustomDlg as the looks of what you said is a custom class, which you are supposed to program and put in a header file with the name MyCustomDlg.h. Then you need to include the "MyCustomDlg.h" in order to use the class in a cpp file. Here is a quick sample.

            MyCustomDlg.h-------------// If Defined dont rewrite code#ifndef _MyCustomDlg_#define _MyCustomDlg_class CMyCustomDlg{public:CMyCustomDlg();~CMyCustomDlg();};#endifMyCustomDlg.cpp---------------// First include the header to use the class#include "MyCustomDlg.h"int main(){// Lets create an instance of CMyCustomDlgCMyCustomDlg Instance;return 0;}            


That was just a sample. Hope this didn't confuse you more then you already are. If you need more help just post your questions.

Neo_Matrix

Edited by - Neo_Matrix on August 13, 2000 1:07:17 AM

Edited by - Neo_Matrix on August 13, 2000 1:08:13 AM
Neo_Matrix
Advertisement
Thanks for responding, but I just noticed something. I redid it and named the workspace Custom. It made classes named CMyCustomApp and CMyCustomDlg. How did the "My" get added there. Shouldn''t it be CCustomApp and CCustomDlg?
-----------------------------Download my real time 3D RPG.

This topic is closed to new replies.

Advertisement