-
May 26th, 2001, 01:34 AM
#1
Declaring global class instances
While making my program, I decided that I want to make a dialog class that would pop up when a button is clicked, and then retain all of the values entered until the program exits. Where and how would I go about declaring this class? Would I have to declare it in the main dialog header/cpp file? I have tried making an instance in several places, but I get errors. This is what I add:
CDlgRoot root; // class that I want to make
When I do this, I get 12 errors saying something along the lines of: "missing ';' before identifier 'root'" , "'CDlgRoot' : missing storage-class or type specifiers" , and "'root' : missing storage-class or type specifiers"
Thank you in advance.
-
May 26th, 2001, 03:47 AM
#2
Re: Declaring global class instances
Hi
Its not so clear to we what you are trying to do
but from what i have been reading i understand that u are trying to create a new dialog and make it show
himself any time you press a button if i am right contact me via my email : nisims@hotmail.com and i will try to help u
have a nice day
-
May 26th, 2001, 08:50 AM
#3
Re: Declaring global class instances
try this
CDlgRoot* m_dlgRoot = NULL; //declare this globally inside your class
CDlgRoot::CDlgRoot()
{
m_dlgRoot = this; //do this inside your constructor
}
//now wherever you need to use this dialog, just use:
extern CDlgRoot* m_dlgRoot;
m_dlgRoot->YourFunction
-
May 26th, 2001, 08:56 AM
#4
Re: Declaring global class instances
It is not very clear what you have in your code. But just try #include "CDlgRoot.h" or whatever header file you have for this class and insert it at the file where you declare the
CDlgRoot root; //
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|