|
Iain, thanks once more!
I tried what you suggested:
I created a class that holds the options:
class WindowOptions {
public:
double xmin;
double xmax;
double xscl;
double ymin;
double ymax;
double yscl;
};
When I create my optionsdialog, I'm passing a pointer to variable of WindowOptions class. But I'm unable to compile my project, I'm getting LNK2005 errors.
"...You could have a structure of information somewhere in the main program, and pass COptionsDlg a pointer to it. Then, if the dialog is closed "properly" (ie, OK button), fill in the structure with the DoDataExchange / UpdateDate method."
Can you give me an example please? Or link where I can read more about it?
|
|
|
|
|
OK, I'll assume you have a small idea about classes, dialog, and dodataexchange. If not, go create some and get an idea!
What I meant was similar to...
struct Options
{
double xmin;
...
};
class CMyApp
{
...
Options m_Options;
...
};
In your main frame, you have a menu handler:
void CMainFrame::OnToolsOptions ()
{
CMyOptionsDlg *pDlg = new CMyOptionsDlg;
CMyApp *pApp = (CMyApp *) AfxGetApp ();
dlg->m_pOptions = &(pApp->m_Options);
dlg->Create (this);
}
void COptionDlg::DoDataExchange (CDataExchange *pDX)
{
ASSERT(m_pOtions);
if (!m_pOptions) return;
DDX_Text (pDX, IDC_XMIN, m_pOptions->xmin);
...
}
I hope those snippets gave you a better idea of what I was thinking!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thank you Iain!
I'm able to pass data between my dialogs.
I have the last question. Promise, the last one
I can catch outside clicks by using SetCapture & OnLButtonUp, but since I run SetCapture() my options dialog receiving no mouse messages inside(If I click on a button in the dialog, the button doesn't get clicked.) What can I do to fix that?
|
|
|
|
|
Hi,
if i want to create only 3 objects how can i restrict the class to do the same...
|
|
|
|
|
#include <iostream.h>
static int nCount = 0;
class Demo
{
public:
Demo()
{
nCount++;
}
};
bool IsMax()
{
if(nCount>3)
return true;
else
return false;
}
int main()
{
Demo d1,d2,d3,d4;
if(IsMax())
{
cout<<"error"<<endl;
}
return 0;
}
|
|
|
|
|
Why don't you keep your wonderful techniques secret?
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]
|
|
|
|
|
I've never even heard of a "tripleton" class, and we have two different people wanting it within hours of each other?
http://www.codeproject.com/Messages/3229571/Class-Object.aspx[^]
Maybe you should speak with your classmate / colleague and collaborate. His question has answers too.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
If you don't stop using multiple logins to ask the same stupid queries, I'll take it to the admin to have all your logins banned.
I remember warning you once already.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: If you don't stop using multiple logins
He's asking for Singleton-like patters just for limiting his logins...
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]
|
|
|
|
|
p_1960 wrote: if i want to create only 3 objects how can i restrict the class to do the same...
You could start by reading the suggestions that people offer, and trying to implement them in your program.
modified on Sunday, October 11, 2009 3:33 PM
|
|
|
|
|
p_1960 wrote: ...how can i restrict the class to do the same...
By reading here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi All,
Actually i am implementing an application for smart card.
But i am confused. whether the read and write methods of SLE4418_28 and
SDI010 will be same or different. I have a sample code for SLE4418_28. So can this code help me to implement the read and write methods for SDI010.
Thanks in advance..
|
|
|
|
|
Hi all,
The following question:
1)string str1 = "a";
2)string str2 = "b";
3)string& refstr = str1;
printf("\n str1: %s,", str1.c_str());
printf("\n str2: %s,", str2.c_str());
printf("\n refstr: %s,\n ", refstr.c_str());
4)str1 = "aa";
printf("\n str1: %s,", str1.c_str());
printf("\n str2: %s,", str2.c_str());
printf("\n refstr: %s,\n ", refstr.c_str());
5)refstr = str2;
printf("\n str1: %s,", str1.c_str());
printf("\n str2: %s,", str2.c_str());
printf("\n refstr: %s,\n ", refstr.c_str());
6)str2 = "bb";
printf("\n str1: %s,", str1.c_str());
printf("\n str2: %s,", str2.c_str());
printf("\n refstr: %s,\n ", refstr.c_str());
displays after each stage :
3)
str1: a
str2: b
refstr: a
4)
str1: aa
str2: b
refstr: aa
5)
str1: b
str2: b
refstr: b
6)
str1: b,
str2: bb,
refstr: b,
May I get an accurate explantion why this is the display for each stage ?
Why after stage 6 the display is not bb for all ?
Thanks in advance,
Eyal
modified on Sunday, October 11, 2009 7:32 AM
|
|
|
|
|
es1968 wrote: May I get an accurate explantion why this is the display for each stage ?
Yes, documentation [^] explains it all:
A reference holds the address of an object, but behaves syntactically like an object.
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]
|
|
|
|
|
Hi Pallini,
Thanks for your the answer, but I want to understand why after stage 6, str1 and strref have not been changed after str2 changed to "bb" ?
It's important for me to understand this, probably I miss something.
Best,
Eyal
|
|
|
|
|
es1968 wrote: why after stage 6, str1 and strref have not been changed after str2 changed to "bb" ?
Because nothing is changing the values of str1 and strref . At stage 6, only the value of str2 is changed, so everything else remains the same. What are you not understanding?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh,
Thanks a lot,
Eyal
|
|
|
|
|
Well, you know, roughly speaking, a reference is a sugar-added-pointer, so let's write your code again, this time using the real thing (BTW no need to say that Klingon developers don't use references, references are for sissies... )
#include <string>
using namespace std;
#include <stdio.h>
void main()
{
string str1 = "a";
string str2 = "b";
string * const pstr = &str1;
printf("\ncase 0\n str1: %s", str1.c_str());
printf("\n str2: %s", str2.c_str());
printf("\n refstr: %s\n ", (*pstr).c_str());
str1 = "aa";
printf("\n case 1\n str1: %s", str1.c_str());
printf("\n str2: %s", str2.c_str());
printf("\n refstr: %s\n ", (*pstr).c_str());
(*pstr) = str2;
printf("\n case 2\n str1: %s", str1.c_str());
printf("\n str2: %s", str2.c_str());
printf("\n refstr: %s\n ", (*pstr).c_str());
str2 = "bb";
printf("\n case 3\n str1: %s", str1.c_str());
printf("\n str2: %s", str2.c_str());
printf("\n refstr: %s\n ", (*pstr).c_str());
}
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]
|
|
|
|
|
CPallini,
Thanks a lot,
Eyal
|
|
|
|
|
I am wondering if I can use a VC6 program to remote control another windows application runing on the same XP desktop ?
ie Can a VC6 program send messages to another windows application to perform actions on it that the user would normaly do with the keyboard and mouse. Essential the analogy is that of pipeing input into a command line program from another source, eg a file.
Perhaps there is a windows application that will already do this without me needing to write one ?
Neil
|
|
|
|
|
Yes, this can be done. You can write your own or look into automated testing frameworks that do this kind of thing. They usually allow you to write a test script that specifies all mouse and keyboard actions that are sent to the target window.
|
|
|
|
|
hi,
I am using visual studio 2008, I wrote a dialog based application, now I want add skins to my dialog. Please give me the approach or give me links related to this issue.
Thanks in advance...
sampath-padamatinti
|
|
|
|
|
http://chimedu1.wikispaces.com/file/view/task.pdf/
|
|
|
|
|
sampath-padamatinti wrote: I want add skins to my dialog.
Take a look at this site[^], it contains some excellent information.
|
|
|
|
|
You can send mail to me,that I will send the DEMO to you.
koma0769@vip.qq.com
More Skin,you can open this url to find:
http://www.appface.com
|
|
|
|
|