|
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
|
|
|
|
|
|
The operator<< function is a friend of your class thus it is not a member of the class.
Change the definition into:
ostream& operator<<(ostream&o, date& a)<br />
{<br />
...<br />
}
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Another thing I didn't see when I first read your post :
The first argument of the operator has to be a stream (cause it is the part which is on the left of the operator). Thus You can't make it a member of the CMyClass class. You have to make it a global function.
So, the solution is to declare the prototype in the header file of CMyClass (but outside the class) and then use this definition:
ostream& operator << (ostream& os, date& d)
{
return os;
}
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Hi All,
I got a problem in creating popup...Can anyone tell me how to get popup window or menu while right clicking the mouse button in a ListCtrl..
thanks in Advance
With regards
Raja Bose
-- modified at 6:43 Thursday 8th June, 2006
|
|
|
|