Return value of a MFC Dialog Box Applicatin..
-
Hello, I want to have a custom return value of a dialog box application. We can change the return value by overriding ExitInstance(). Is it possible to have a string as return value? If yes how to achieve this? Thank you..
-
Hello, I want to have a custom return value of a dialog box application. We can change the return value by overriding ExitInstance(). Is it possible to have a string as return value? If yes how to achieve this? Thank you..
The DoModal function returns an integer so you won't be able to change that (except if you create your own function to create the modla dialog). But anyway, this is in general not needed: you could simply add a function that returns you the string. The return of DoModal is used to return informatino about how the dialog has been closed to the user. It doesn't make a lot of sense to return some kind of data there.
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++ -
Hello, I want to have a custom return value of a dialog box application. We can change the return value by overriding ExitInstance(). Is it possible to have a string as return value? If yes how to achieve this? Thank you..
Do you really want to return a string value to the
OS
? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Do you really want to return a string value to the
OS
? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]maybe it's called from another process ?
This signature was proudly tested on animals.
-
maybe it's called from another process ?
This signature was proudly tested on animals.
Do you really want to return a string value to another process? ;P
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Do you really want to return a string value to another process? ;P
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]nope; but maybe the OP wants to.
This signature was proudly tested on animals.
-
nope; but maybe the OP wants to.
This signature was proudly tested on animals.
Well, he should know then there are a lot of IPC mechanisms. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Well, he should know then there are a lot of IPC mechanisms. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Requirement is to return a String? So have to find a soultion for it :( .. It is used by other process and that is already defined to take String as input..
-
Requirement is to return a String? So have to find a soultion for it :( .. It is used by other process and that is already defined to take String as input..
You may, for instance, return a
integer
value and then call the other process with astring
appropriate to such ainteger
return value, e.g. (pseudocode):int r = call(myProcess);
switch( r )
{
case eOK:
call(theOtherNastyProcess, "OK");
break;
...
}:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Requirement is to return a String? So have to find a soultion for it :( .. It is used by other process and that is already defined to take String as input..
Did you get your question fully answered by Cedric's response? I couldn't tell from your reply. If not, here's a little code snippet to demonstrate what (I believe) he was suggesting:
CMySpecialDialog MyDialog;
const int Status = MyDialog.DoModal();
if (Status == IDOK)
{
const CString MyString = MyDialog.GetMyString();
}This will work if you define a GetMyString method in your CMySpecialDialog class. Just remember to keep the string value in a member variable of the CMySpecialDialog class so that it still exists after the return from DoModal. HTH
-
Did you get your question fully answered by Cedric's response? I couldn't tell from your reply. If not, here's a little code snippet to demonstrate what (I believe) he was suggesting:
CMySpecialDialog MyDialog;
const int Status = MyDialog.DoModal();
if (Status == IDOK)
{
const CString MyString = MyDialog.GetMyString();
}This will work if you define a GetMyString method in your CMySpecialDialog class. Just remember to keep the string value in a member variable of the CMySpecialDialog class so that it still exists after the return from DoModal. HTH
Thank you.. I will try on these lines..