|
CWnd::GetFocus returns pointer to window having focus.
|
|
|
|
|
hi
I have written this
int status = CView::OnMouseActivate(pDesktopWnd, nHitTest, message);
if(GetFocus()!=GetParent())
GetParentFrame()->SetFocus()->RedrawWindow();
return status;
what i want is it will not redraw window when foucs is on the same window and i clicked.
but in this code it always go in if condition.
Thanks ,
Rushiraj
|
|
|
|
|
rushiraj.jhala wrote: if(GetFocus()!=GetParent())
This should be like this,
if((*GetFocus())!=(*GetParent()))
{
}
|
|
|
|
|
sorry,
it is not woriking for me.
|
|
|
|
|
rushiraj.jhala wrote: it is not woriking for me.
I told you the way to compare the windows.
What type of error it is givng. I could not understand your logic basically.
|
|
|
|
|
int CImageView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
int status = CView::OnMouseActivate(pDesktopWnd, nHitTest, message);
if((*GetFocus())!=(*GetParent()))
GetParentFrame()->SetFocus()->RedrawWindow();
return status;
}
I have one Doc/view applivation in that i have one other dialog box also.
so when i click inside the view of my chid frame i want to check if this chid has foucs or not because if this frame has allready focus i dont need to redraw window other wise if dialog has foucs i have to set foucs the chid frame containing that view and redraw widnow.
for that in onmouseactive i wnat to check child frame is fouced or dialog box has foucs.
|
|
|
|
|
rushiraj.jhala wrote: so when i click inside the view of my chid frame i want to check if this chid has foucs or not
Whenever you click on a window, it will get focus automatically.
|
|
|
|
|
yes it will be
what i want is if child frame is focused and I click in client area of child i dont want to call GetParentFrame()->SetFocus()->RedrawWindow().
but in other case if dialog is focused and when i click on client area of child it will be focused but in addition i want to call GetParentFrame()->SetFocus()->RedrawWindow() function.
for that i want to know befour i have clicked is this child window is fouced or dialog.
|
|
|
|
|
rushiraj.jhala wrote: but in other case if dialog is focused and when i click on client area of child it will be focused but in addition i want to call GetParentFrame()->SetFocus()->RedrawWindow() function.
I really cant understand your requirement. In this case, you will never get focus on dialog in your question.
|
|
|
|
|
Dear, Dear,
I understand the problem now.
Refer your original code,
You are comparing window with focus with parent window of view, which will be child frame.
You need to modify your original code to this,
int CImageView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
if((*GetFocus())!= (*this))
SetFocus()->RedrawWindow();
return CWnd::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
|
|
|
|
|
It works fine.
Thans Dear.
|
|
|
|
|
use CWnd::GetFocus() , it will return you the handle of the windows having the focus...
|
|
|
|
|
hi
I have written this
int status = CView::OnMouseActivate(pDesktopWnd, nHitTest, message);
if(GetFocus()!=GetParent())
GetParentFrame()->SetFocus()->RedrawWindow();
return status;
what i want is it will not redraw window when foucs is on the same window and i clicked.
but in this code it always go in if condition.
Thanks ,
Rushiraj
|
|
|
|
|
Hi,
How to add Html help to an existing mfc Dialog based application.. can u please suggest some ways.
Harsha
|
|
|
|
|
|
I found everything I needed to know about HTML help here:
HTML Help Workshop and Documentation[^]
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Hi,
I am using this line right now to change statusbar color
m_bar.GetStatusBarCtrl().SetBkColor(RGB(45,200,200));
note:m_bar is CStatusbar variable.
but with the help of this statement i am able to change statusbar color in "visual studio 2003" but not in "visual studio 2005". Any suggestions please.
Harsha
|
|
|
|
|
harsh_2961 wrote: but with the help of this statement i am able to change statusbar color in "visual studio 2003" but not in "visual studio 2005". Any suggestions please.
check libarary you are using
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Hello everybody!
I would like to know if there is any way to block a user from shutting down or logging off the system. Or atleast postpone the shutdown process for a particluar time interval.
Is it possible to do that?
I humbly request to respond me!
Thanks in advance!
regards,
Shalini
|
|
|
|
|
Handle WM_QUERYENDSESSION message is your application. return FALSE to stop the shutdown of logoff process.
if (message == WM_QUERYENDSESSION)
{
if(allow)
{
return TRUE;
}
else
{
return FALSE;
}
}
|
|
|
|
|
overide the WM_QUERYENDSESSION message and return 0. And after you have done your time interval call ExitWindows() to shutdown.
nave
|
|
|
|
|
Handle WM_QUERYENDSESSION and return false from there.. then shutdown the window using InitiateSystemShutdown api
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
How to use the SendDlgItemMessage() function to simulate a click event of button instead of using SendMessage() or PostMessage()?
Thanks & Regards,
Suman
|
|
|
|
|
Use BM_CLICK .
SendDlgItemMessage(IDOK,BM_CLICK,0,0);
|
|
|
|
|
prasad_som wrote: BM_CLICK.
they is no such thing like BM_CLICK .... are you referring BN_CLICK
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|