How to set Member variable as extern variable [modified]
-
Now here is a class
class CPipeLineApp: public CWinApp
{
public:
CDengLu* dgDlg;
.......
}I want to set
dgDlg
as a extern variable so that I can call dgDlg in classCMainFrame
.dgDlg
has variables :name
andpass
. I want to call them too. Please lend me a hand.modified on Wednesday, March 16, 2011 8:43 PM
-
Now here is a class
class CPipeLineApp: public CWinApp
{
public:
CDengLu* dgDlg;
.......
}I want to set
dgDlg
as a extern variable so that I can call dgDlg in classCMainFrame
.dgDlg
has variables :name
andpass
. I want to call them too. Please lend me a hand.modified on Wednesday, March 16, 2011 8:43 PM
Jokcy wrote:
I want to set
dgDlg
as a extern variable so that I can call dgDlg in classCMainFrame
.As it is,
dgDlg
can be accessed from anyCMainFrame
method."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
-
Now here is a class
class CPipeLineApp: public CWinApp
{
public:
CDengLu* dgDlg;
.......
}I want to set
dgDlg
as a extern variable so that I can call dgDlg in classCMainFrame
.dgDlg
has variables :name
andpass
. I want to call them too. Please lend me a hand.modified on Wednesday, March 16, 2011 8:43 PM
You don't have to set that as an
extern
, its public and part of CMainFrame... means you should be able to reach it from any CMainFrame... what are you trying to do? -
Jokcy wrote:
I want to set
dgDlg
as a extern variable so that I can call dgDlg in classCMainFrame
.As it is,
dgDlg
can be accessed from anyCMainFrame
method."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
-
Jokcy wrote:
I want to set
dgDlg
as a extern variable so that I can call dgDlg in classCMainFrame
.As it is,
dgDlg
can be accessed from anyCMainFrame
method."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
-
You don't have to set that as an
extern
, its public and part of CMainFrame... means you should be able to reach it from any CMainFrame... what are you trying to do? -
As far as I understand your question, you can access it like below.
((CPipeLineApp*)AfxGetApp())->dgDlg;
-
I'am so sorry .I've made a serious mistake.
class CPipeLineApp : public CWinApp
{
public:
CDengLu* dgDlg;
.....
};I want to call
dgDlg
in classCMainFrame
. I also want to calldgDlg
's variables:name
andpass
Forwarding your help.still not sure what the problem is... if CPipeLineApp is derived from CWinApp, then he owns the CMainFrame, so you have complete access to it...
-
I'am so sorry .I've made a serious mistake.
class CPipeLineApp : public CWinApp
{
public:
CDengLu* dgDlg;
.....
};I want to call
dgDlg
in classCMainFrame
. I also want to calldgDlg
's variables:name
andpass
Forwarding your help....I'm thinking you don't really know the MFC framework?
-
As far as I understand your question, you can access it like below.
((CPipeLineApp*)AfxGetApp())->dgDlg;
ozer's right... my 5! [i forgot you can rate these!]
-
...I'm thinking you don't really know the MFC framework?
-
see what ozer wrote above... i think i misunderstood your question, i thought you were trying to access cmainframe from cwinapp, a trivial operation, but you're really trying to access
dgDlg
(who is owned the cwinapp) from the cmainframe... that's not as trivial (but almost... ;P ) Happy coding! :) -
As far as I understand your question, you can access it like below.
((CPipeLineApp*)AfxGetApp())->dgDlg;
-
don't forget to vote his answer up as good! ...i just had someone come around and downvote some of my posts :mad:
-
ozer's right... my 5! [i forgot you can rate these!]
Thanks. :)
Time is never on our side! -- Albert Holguin
-
Thanks. :)
Time is never on our side! -- Albert Holguin
interesting quote... sounds familiar... :laugh:
-
interesting quote... sounds familiar... :laugh:
But, I couldn't find out how I could save it as default in my settings. Do you know how?
-
But, I couldn't find out how I could save it as default in my settings. Do you know how?
Have no idea! ...i've only recently become an active participant in this forum... :doh:
-
But, I couldn't find out how I could save it as default in my settings. Do you know how?