|
Hello li zhiyuan,
the warning is due to the fact that your are assigning a double value to a variable of type long . i.e.
double d = 3.5f;<br />
long l = d;
and the warning says that you will loose your data and l will caontain only 3 instad of 3.5.
if this is ok for you than you can suppress this warning by typecasting.
i.e.
double d = 3.5f;<br />
long l = (long)d;
hope this answers your quetion.
Also have you added message handler for the new menues that you are creating??
-- modified at 7:31 Thursday 8th June, 2006
|
|
|
|
|
hi,
i want to develop one application in VC++ 6.0-MFC ,which can able to store a PDF file to oracle database in a column - BLOG "datatype".
Is it possible to do that thing in VC++ 6.0
i found most of application in .NET ,not in VC++.
can any one please help for the same..
send reply
|
|
|
|
|
Hi
I added a class in my MFC dialog based project. Now i want to declare a pointer object of my dialog class in .cpp file of newly added class to access members of dialog class in that cpp file. I declared that pointer like this
CFileSenderDlg *fsD = new CFileSenderDlg;
But program crashes at the point where i use this pointer to access a member function of dialog class. What it the mistake i am doing? Can anyone please help me in this regard?
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
The code seems very clean.
1. Check whether the pointer get allocated properly or not (NULL or Junk value).
2. Check for the missing resources, which hadn' is not removed on deleting the control.
3. Check the message handlers
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
Sorry i was wrong. In fact error occures when i try to declare the pointer.
When i tried to debug it, It took me to afxwin1.inl and current pointer was on following lines. Can you please tell me what is the problem?
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()<br />
{ ASSERT(afxCurrentResourceHandle != NULL);
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Sorry for the late reply.
Walk ur call stack and find from where this call occurs.
check for missing resources that may be the problem
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
Aqueel wrote: CFileSenderDlg *fsD = new CFileSenderDlg;
After this, you should create the dialog box also like:
fsD->Create(IDD_WHATEVER,Parent);
Also check that the actual dialog resource is really present by looking at the resource view, and then checking the ID for the dialog.
this is this.
|
|
|
|
|
See here
<br />
CTest::CTest(CWnd* pParent )<br />
: CDialog(CTest::IDD, pParent)<br />
{<br />
Create(CTest::IDD,pParent);<br />
}<br />
--------------------<br />
CTest *m_Test;<br />
m_Test=new CTest(this);<br />
whitesky
|
|
|
|
|
Hi
Right now I am working with MessageBoxes.Is there a way to define my own Buttons for the MessageBox with a caption of my wish and handle the ButtonClicked event?
Thanks in advance
Taruni
|
|
|
|
|
I don't think that is easily possible with the default messagebox. However, you can create a custom message box by defining your own dialog box resource, and returning the proper values from it (EndDialog (VALUE_HERE) ) under different buttons, with everything under your control (caption, focus, text size etc), and using it with its DoModal() function.
this is this.
|
|
|
|
|
Even if there are some methods for affecting the standard system’s message box (see, for instance, http://www.codeproject.com/cpp/dMsgBox.asp[^]), I think you should consider creating of your own dialog, with buttons you need.
|
|
|
|
|
|
Hi friends
I want to ask if i declare a function like
friend ostream& operator<<(ostream& , date&); in a class declaration. Does it become friend function of that class. Can it access private members of class? If yes how i should define it in .cpp file of that class?
Thank you
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: Does it become friend function of that class
yes, that's why the friend keyword is made for.
Aqueel wrote: it access private members of class?
no. friend functions/classes access at most protected members (and of course public ones), but not private.
yes...
Aqueel wrote: If yes how i should define it in .cpp file of that class?
you declare it in the class which it is a friend of :
class CMyClass {
public:
friend ostream& operator << (ostream&, date&);
};
and then, define it in a .cpp (generally, in the .cpp which defines your class' members) :
ostream& CMyClass::operator << (ostream& os, date& d) {
return os;
}
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-- modified at 7:04 Thursday 8th June, 2006
|
|
|
|
|
toxcct wrote: Aqueel wrote:
it access private members of class?
no. friend functions/classes access at most protected members (and of course public ones), but not private.
It is wrong.
you can access private members using friend function.
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
toxcct wrote: no. friend functions/classes access at most protected members (and of course public ones), but not private.
Wrong, it can access also private members (otherwise, this would be stupid): source[^]
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
|
What was there inside the MSDN? I think there is nothing saying in MSDN about a friend function accessing private and public or protected!!!
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
From MSDN:
In some circumstances, it is more convenient to grant member-level access to functions that are not members of a class or to all functions in a separate class. The friend keyword allows a function or class to gain access to the private and protected members of a class. You can declare friend functions or friend classes to access not only public members but also protected and private class members.
Check it here!!![^]
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
Uh . I just posted this link in the post above...
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
|
and what does the last sentence you quoted means for you ???
"You can declare friend functions or friend classes to access not only public members but also protected and private class members."
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Thanks for responding.
I have declared function in class decalaration like this
class date <br />
{<br />
private:<br />
....
....<br />
....<br />
public:<br />
date(int=1, int =1, int =1900);<br />
friend ostream& operator<<(ostream& , date&);<br />
}
Now i define this function is .cpp file like this
ostream& date::operator<<(ostream&o, date& a)<br />
{<br />
o<<year<<month<<day<<endl;<br />
return o;<br />
}
but it gives me this error,
error C2039: '<<' : is not a member of 'date'
Why this error is occuring?
Thanks
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
|
Sorry toxcct, I could not get your point. Can you please explain it? Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|