Getting the width of the icon area of a context menu - winapi

I need to get the width of the icon area of a context menu using the Windows API (>= Windows XP if this matters). What I mean by icon area you can see in this question, there is an image. It is a space reserved for icons on the left side of the menu.
I scanned through the wealth of information you can get via SystemParametersInfo and GetSystemMetrics, but found nothing. But there has to be some default value, right? How could I get it?

A native win32 menu does not really support icons so you can't really call it the icon area. In a basic menu the size of that area is SM_CXMENUCHECK wide (Plus SM_CXEDGE for padding probably) For Vista+ you might be able to find some better metrics with the MENU_POPUP* constants and GetThemeInt. AFAIK the exact layout and border constants required to replicate classic Win95+ menus are not documented.
Since you are talking about icons I assume you want to add icons to your menu so your width should probably be max(yourIconWidth,GetSystemMetrics(SM_CXMENUCHECK)) + padding. This old MSJ article is probably the best menu owner draw tutorial out there, and codeproject has its own menu article section with several different owner draw implementations. (MS Office and Visual Studio use custom stuff as well)
As a final note, since you said XP+ you should be able to use HBMMENU_CALLBACK and only worry about the icon and not the rest of the menu drawing...

Related

Oracle Forms toolbar size

When creating a menu in Oracle Forms 6i, you can set a property for each menu option to be visible or not in the horizontal menu toolbar. You can also set the icon for the button on the toolbar and the text to display when hovering your mouse over it.
What I cannot find is the properties for the toolbar itself. It doesn´t seem to be possible to change the size, color or any other property for the toolbar.
I specifically want to change the size of the icons, since being an old tool, it was designed by default to work with 16x16 icons, but with current screen resolutions, the toolbar looks way to small.
Using larger icons doesn´t do the trick, since it just cuts the icon to 16 by 16.
Am I missing something? is it possible to adjust the toolbars properties?
Adjusting the size of the toolbar is a new feature in Forms 12c. It is not available in earlier versions.
"do you have any source for this?"
I saw Michael Ferrante (the Forms Product Manager) talk at UKOUG on Monday. So straight from the horse's mouth :) The Forms 12c New Features guide is here: page 12 is the page which will break your heart.

WP7 - Text Button on the Application Bar

On Windows Phone 7, go to Settings, email & accounts, add an account, the Windows Live (or any other). Note at the bottom there is the gray panel with a rectangular [sign in] button. Click in the email address field, and the on screen keyboard pops up ABOVE the gray panel. Rotate the phone, and the gray panel does not rotate, although the page does. That gray panel is the Application Bar, is it not?
I only find docs for adding an icon-based round button (and menu items). How do we put a rectangular textual button on the Application Bar?
Adding buttons in the Application Bar is not supported for third party developers. The Application Bar itself is not a Silverlight control; it's a native one. Only OEMs, certain partners and MS have access to the native SDK, so you won't be able to template the Application Bar to have buttons. Of course, you could create your own Application Bar that mimics the real one, but I don't recommend that approach as it would be very tricky to get it exactly right and be consistent between apps.
Yes, that's the application bar. Well, it's the non Silverlight version of it. (The built in apps are not built with Silverlight.)
Unfortuanately it is not possible to use text buttons on the application bar. It's only possible to use buttons with images.
Yes it would be nice/useful in a number of situations but it's just not possible with the current SDK (even Mango). I keep hoping it'll be there in a future version...
The applications that come with the phone are not restricted to using developer APIs and the one you mention likely uses C++ and / or restricted APIs. As a third-party developer your only option is to stick with icons on the application bar.
You can always create a Panel colored like the application bar, aligned along the bottom of the screen and display buttons or whatever other UI element you want to.

Buttons on ApplicationBar (WP7)

If you open settings of wifi and choose any network you will see Password textbox and BUTTONS (not icons) in ApplicationBar. How it is made? Is it some kind of ApplicationBar template? Or it is some Border control, but how to show a Border above the SIP(keyboard)?
Any ideas how to make the same thing?
What are you describing was not created using Silverlight (all the "hero" applications are done in C++) and are therefore not limited by the current SL feature set.
In relation to your actual question, it is not possible to template the ApplicationBar nor is it even possible to determine when the SIP is displayed (or what its height is).
In short, I'd stick to icons if you want your application to work well across devices.

How can i change the appearance of Windows 7 menus?

My Win32 Application displays Menus as shown when running on Win 7:
This is the Default for the themes Windows 7 as well as Windows 7 Aqua.
Please note that the selected menu entry is only slightly different from the other entries. I think it is much too less highlighted and therefore i am looking for a way to give the selected entry a different color. But unfortunately all possibilities to modify menu colors disappeared in Windows 7. The settings made in the window color dialog are non effective for menus.
But amazingly Microsoft's own applications look different. I.e. Paint has different color and appearance of menus:
This has good contrast and is much better than the default for a Win32 application.
Also Visual Studio 2010 looks different:
I know that VS 2010 is build on WPF. I don't know if and how the ribbon, used in paint influences the menu appearance. My menus are set up dynamically using SetMenu();
My Question: Is there any way to change the appearance of my applications menu using a API or maybe a manifest or resource?
Or is there a way to modify the color of the selected menu entry in Windows 7 through settings?
You can make your own user drawn menus. For an example, take a look at this CodeProject.com article: http://www.codeproject.com/KB/menus/newmenuxpstyle.aspx
Also, VS 2010 is not entirely built on WPF - only the code editor.

Vista/Win7 Listview "View Slider"

In Vista and Windows 7 almost any time the system uses a standard Listview (ie: Explorer Windows) it's accompanied by a little split button that shows a slider when the split is clicked that allows you to switch between the different views available for that listview (Tile, Details, List, etc.) as well as sliding smoothly between icon sizes (from 32x32 is to 256x256) using the top half of the slider.
This is a cool little bit of functionality, so I was wondering: Is that control available to developers, and if so what is it called and where is it documented? (Win32/C++ preferred)
Turns out in Windows 7, the explorer window is no longer a standard listview (though it does an extremely good job of looking like one). Open Spy++, point it at an explorer window list pane, and you'll see a classname of "DirectUIHWND" instead of the old "SysListView32".
The actual slider itself is indeed a real ComCtl32 slider; so you could perhaps roll your own; but as far as I know there's no way to reuse the existing explorer pane's functionality.

Resources