[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to get HWND from a CMenu

Posted on 2004-08-19
10
Medium Priority
?
1,131 Views
Last Modified: 2013-11-20
Hi all,
i wonder on how to get the HWND for a CMenu, sind it's not derived from CWnd.
The reson is that i want to change the window style of a popup menu.
Therefore i wrote my own menu class derived it from CMenu and implemented MeasureItem and DrawItem to have a ownerdrawn menu.
But I want to have the popup menu shown up as a flat window without any border.
Thats why i want to get the hwnd or if possible the CWnd* of this menu.

Any suggestions?
0
Comment
Question by:ulf_k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 180 total points
ID: 11840097
I don't think a CMenu has a HWND (or CWnd*).  As you said it is not derived from CWnd.  It may use the window that owns it.
Style - in resource editor create a main menu as you normally would and then your menu is a popup menu from this.  (See GetSubMenu in help)
0
 

Author Comment

by:ulf_k
ID: 11840126
But if it's a popup menu there is no widow that owns it. But the popup menu is a window itself.
As i wrote, i coded my own menu class derived form CMenu, this means i won't use the resource editor, cause i have my own way to add items and submenus.

Greetings, -ulf-
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 11840192
Have a look at this function  CMenu::TrackPopupMenu  it is in the file wincore.cpp.  That is how a popup menu is handled (context menu).  

ps. It does have a parent window - the app.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ulf_k
ID: 11840474
Hmm, thanks, but that desn't help me to get the HWND or CWnd* of the menu when it's created.
I don't think a menu is created when displayed and destroyed afterwards.

Greetings, -ulf-
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 11840490
The menu exists all the time.  I think the window it is displayed in is purely temporary.
0
 

Author Comment

by:ulf_k
ID: 11840780
so, no chance to get off the beveled border?!

Greetings, -ulf-
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 11841172
Offhand I don't know how.
0
 

Author Comment

by:ulf_k
ID: 11869760
So, nobody knows?!
Then you get the points.
Thanks for trying to help!
Greetings, -ulf-
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 11870026
Thanks
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 11870276
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question