Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

If I have a HMENU handle, can I create a C# menu object?

Thanks in advance!
Posted

Many .NET framework objects can be created from handles though - for example bitmaps and cursors, I was wondering if there was an equivalent for the menu class (like a 'FromHandle') function?
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 23-Sep-11 9:52am    
This is very true (my 5), but I wonder why would you need to do that if you already have a ready-to-use framework with System.Windows.Forms. Are there interesting effect you can achieved by using the native handles? Remember that it will kill platform compatibility. I run my .NET applications using Forms on Linux and Mac without recompilation, under Mono. Using handles would destroy the functionality on non-Windows platforms.
--SA
No, a HMENU is of course an unmanaged pointer to the menu window and is not the same as a .net menu object.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900