popup menu


I'm developing a MDI application and need to display
a floating menu calling TrackPopupMenu (..) at a location
relative to the top left corner of the view ( not the child frame)
How should I modify the coordinates to do this.By default,
the position is always relative to tte main frame window.

Thanks.
e6694811Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PIGCommented:
CRect rect;
view->GetClientRect(&rect);
AfxGetApp()->GetMAinWnd()->ScreenToClient(&rect);
ret.left, rect.top is location for top left corrner of the client window.

And
CRect rect;
view->GetWindowRect(&rect);
AfxGetApp()->GetMAinWnd()->ScreenToClient(&rect);
ret.left, rect.top is location for top left corrner of the miniframe.
e6694811Author Commented:

 Hmm.It does not seem to work because the location
obtained is not the desired .For example ,if call Trackpopup menu with p.x =p.y =0 , the top-left corner of the floating menu
should be located at the top-left corner of the wiew .
abancroftCommented:
The help says TrackPopupMenu() uses SCREEN co-ords. So 0,0 should be located at the top left of the screen.

On that assumption, here's code to display the menu at the top left of the view:
CRect rect;
view->GetWindowRect(&rect);
menu->TrackPopupMenu(TPM_LEFTALIGN, rect.left, rect.top, view, NULL);
e6694811Author Commented:

 It worked .Send an anwer so that I can grade your response
an give the points.
abancroftCommented:
Great!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.