|
Are you wanting something like:
#include "MyDialog.h"
class myclass
{
CMyDialog dlg;
};
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You need to create a class for your dialog first. If you use the classwizard, it will do it for you. You can then do what David mentioned in his post.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
You insert a dialog to your resource and now you want to insert calss and data members to it,Right?
|
|
|
|
|
Suppose in a doc view architecture,
If all the classes say Frame,Doc,view,and App class add event handler for a single (same event, say IF_FILE_MYCOMMAND)event.
if that event fired to the application, it's getting to view class... what is the reason?
|
|
|
|
|
Events/Messages are passed to the child windows for processing before the parent is allowed to process them. If you don't want the view to handle it, don't declare a handler for it.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
But in this case doc is also a child class no?
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Yes, sort of. Since the Document class is primarily there to hold your data, it doesn't have its own window (that is what the View is for). For messages/events purposes, it is considered a child of the frame class, though (and in that respect, it is on the same level as the View class(es)).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
I just debugged with sample application. Answer seems like this.
As per the CFramWnd’s implementation, it first routes the message to current view. The handler defined in the view class will invoke. If no handler inside the view class, CView class will pass the document class attached.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Yeah, debugging is good. Keep ahead!
And take a look in the links I have posted below OP.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi All,
I have a VC++ application its a bit big application having more than 10 ATL
components. The application is client/server architecture with
multi-threading. The server does the data trasnfer from one database to
another using ODBC/OLEDB.
If at all I want to change the technology from VC++, is it advisable to
migrate it to .NET? Can any one comment on the migration plan from vc++ to
.NET?
--
Thanks
ChitraCK
|
|
|
|
|
hi everybody,
i have an issue regarding running dos comds from vc ++ program . If we want to run user interactive command from the vc++ how can we do it.
to amplify the issue , there is a command which says gcc -v, now the output of this command is a one time single line output, which requires no user input. Now i am able to run such one line commands through vc++ GUI, however, I am having problem in running commands which require user input, say if there is a command which says gpg --gen-key , now this command when run in command prompt prompts user for various inputs like choose encryption algo, give user name , email id, etc..... .Now How can a GUI be build to run such commands which only get completed after taking various inputs from user ...If you feel i need to study more kindly show me the path to study something in the right direction...the field and subject is so vast otherwise..
can any one please guide me if there is another approach or a better way to do .......in vc++ using MFC .
thanks to all who took pain to read the query atleast....
vineet madan
-- modified at 9:20 Thursday 3rd August, 2006
Thanks to everybody who even thought of helping me. regards--vineet
|
|
|
|
|
Are you wanting to pass data to your console application from your GUI application? If so, see here and here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Dear david,
thanks for the reply , i am going through the tuorial u have mentioned. . I must thank you once again for prompt reply. I will look fwd for more guidance from you.
regards --vineet
Thanks to everybody who even thought of helping me. regards--vineet
|
|
|
|
|
Hi,
If I can declare a function as
void Show(int i = 1729,double d);
But I can't call this function by passing only 2nd argument then what is the use of that function? OR How to use this function (to pass only 2nd argument)?
ex.
void Show(int i, double d = 3.14);
void Show(int i = 1729,double d);
void Show(int i, double d)
{
printf("\n\t %d %0.2lf",i,d);
}
main()
{
Show(); // Output 1729 3.14
Show(12); // Output 12 3.14
Show(45,5.6); // Output 45 5.60
Show(23.9); // Output 23 3.14 ....... But can I get output as 1729 23.9 ?
}
Thanks & Best Regards,
Aniket Salunkhe
|
|
|
|
|
default arguments only starts at the end of the parameters list...
|
|
|
|
|
toxcct wrote: default arguments only starts at the end of the parameters list...
I know that...but see the program given by me ... it doesn't show error
-- modified at 9:08 Thursday 3rd August, 2006
|
|
|
|
|
Only the last arguments in the arguments list can assume a default value.
"void Show(int i = 1729,double d);" is not correct
If you need to pass int or double you can use polymorphism ...
void Show( int i= 1729 );
void Show( double d=3.14);
void Show(int i, double d);
|
|
|
|
|
Nyarlatotep wrote: If you need to pass int or double you can use polymorphism ...
void Show( int i= 1729 );
void Show( double d=3.14);
void Show(int i, double d);
This is function overloading ... not polymorphism.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
also called "function polymorphism"
|
|
|
|
|
Polymorphism is generally used with reference to classes or objects, and it deals with method OVERRIDING, not overloading.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Arguments with default values must come at the end of the argument list. C++ does not provide a syntax for specifying missing arguments.
Another thing you might be seeing, since you are using numeric arguments, is that the compiler will automatically convert numeric constants to the correct type.
The best way to do this would be:
void Show(double d,int i = 1729)
{
printf("\n\t%d %lf",i,d);
}
main()
{
Show();
Show(12);
Show(5.6,45);
Show(23.9);
}
Software Zen: delete this;
|
|
|
|
|
You cannot pass just the second parameter. If you change the declaration so that the default parameters are the last arguments to your function, you can pass the first arguments and skip the default ones (if desired), but you cannot do it the way you are trying to.
Also, you cannot create the same function with the same arguments and different default parameters.
Aniket Salunkhe wrote: void Show(int i, double d = 3.14);
void Show(int i = 1729,double d);
void Show(int i, double d)
Declaring all 3 of those will give you a compiler error.
void Show(double d, int i = 1729);
Show(3.14);
Show(3.14, 2000);
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Neither C nor C++ support "named parameters." See here for more.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|