|
You're going wrong somewhere. Did you try debugging?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I can be the reason you are not properly pumping the message, how you create the dialog, where is the code to set the text in the dialog resides.
|
|
|
|
|
ThatsMe. wrote: SetDlgItemTextA(IDC_EDIT1,nday);
What is the value of nDay at this point? What does SetDlgItemTextA() return?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
nday gives the total calculated no of days.
and there is no value show in EditBox after using of SetDlgItemTextA();
Thanks & Regards
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Can you insert simple text to editbox?
|
|
|
|
|
ThatsMe. wrote: nday gives the total calculated no of days.
and there is no value show in EditBox after using of SetDlgItemTextA();
This answers neither of my questions.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
You can achieve this by sub classing your edit box. For this you have to use the API SetWindowLong where you will set a new window proc so that the entire message will be redirected to this new window proc. Here you can achieve the functionality by handling the appropriate message.
|
|
|
|
|
Can u please tell me this with example.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I am not getting what is your exact requirement any how I am giving you the skeleton to do sub clssing.Suppose handle of edit box is
hWndEdt
then
WNDPROC oldEditProcedure ;
WINAPI SubClassFunc(HWND hWnd,WORD Message,WORD wParam, LONG lParam);
oldEditProcedure = (WNDPROC) GetWindowLong(hWndEdt, GWL_WNDPROC);
SetWindowLong(hWndEdt, GWL_WNDPROC, (LONG)SubClassFunc);
do not forget to call in your destructor or at the appropriate place
SetWindowLong(hWndEdt, GWL_WNDPROC, (LONG)oldEditProcedure );
WINAPI SubClassFunc(HWND hWnd,
WORD Message,
WPARAM wParam,
LPARAM lParam)
{
if(Message == WM_PAINT)
{
SetWindowText(hWnd, "Hello SubClassFunc");
}
return CallWindowProc(oldEditProcedure, hWnd, Message, wParam, lParam);
}
|
|
|
|
|
All this is not required to solve the query that was asked. See the answer from Sarath.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
base class:
class B ()
{
public:
virtual ~B(){};
}
No difference between the two derived classes below?
I've tried, both can destruct.
class D : public B
{
public:
virtual ~D(){}
}
class D : public B
{
protected:
virtual ~D(){}
}
|
|
|
|
|
followait wrote: No difference between the two derived classes below?
Nope. There is a difference (find it here [^]).
followait wrote: I've tried, both can destruct.
How?
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
|
|
|
|
|
Here is the code.
Though
D::~D() is protected, it works just like public, any differece?
#include <iostream>
#include <assert.h>
using namespace std;
class B
{
public:
B(){v();}
virtual ~B() {
assert(false);
int j=0;
++j;
}
virtual void v(){cout<<"B"<<endl;}
private:
};
class D : public B
{
public:
D(){v();}
protected:
~D() {
assert(false);
int i=0;
++i;
};
virtual void v(){cout<<"D"<<endl;}
private:
};
int main()
{
B *p=new D;
delete p;
return 0;
}
|
|
|
|
|
Your code does not compile. Anyway, probably you intended something similar to
#include <iostream>
#include <assert.h>
using namespace std;
class B
{
public:
B(){v();}
virtual ~B() {
cout<<"~B"<<endl;
}
virtual void v(){cout<<"B"<<endl;}
private:
};
class D : public B
{
public:
D(){v();}
protected:
~D() {
cout<<"~D"<<endl;
};
virtual void v(){cout<<"D"<<endl;}
private:
};
int main()
{
B *p=new D;
delete p;
return 0;
}
it outputs (maybe surprisingly):
B
D
~D
B
It compiles due to runtime binding. I.e. compiler doesn't know that D destructor will be called.
As someone already pointed out, however, you cannot use the following code
D d;
while
B b;
is legal.
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
|
|
|
|
|
Is this a loop hole in C++ or it is left like that for some specific reason?
|
|
|
|
|
It isn't a bug, it's feature. More likely a side effect, though.
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
|
|
|
|
|
you mean accessing a virtual protected derived class member using a base class pointer is a feature?
|
|
|
|
|
Yes, it is a side effect of polymorphism.
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
|
|
|
|
|
Its the normal behaviour of virtual members, the access control is compile time restriction it depends on which function you call. see this, [Access to Virtual Functions^].
|
|
|
|
|
followait wrote: protected: virtual ~D(){}
Did you success in creating an object of the class D in another class or global function?
|
|
|
|
|
|
D objD;
can't be compiled, and
D *p=new D();
delete p;
also can't be compiled.
However,
B *p=new D();
delete p;
works.
I know, it should be called through the right interface.
Thanks.
|
|
|
|
|
Obvious that, that are the difference you can expect from the protected keyword, you cannot have obj of D allocated other than through new operator you can delete only through B and it remains correct only if B has virtual destructor.
I mean protected keyword does its job expected.
|
|
|
|
|
Hi,
Any one know which message Windows sent to Explorer windows indicating a new file is created so that it must refresh and indicate the new changes in the Explorer window.
thanks
Nitheesh
|
|
|
|