- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can anyone help me on the following?
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.
Any help with this will be appreciated.
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.
Any help with this will be appreciated.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dannycat
Can anyone help me on the following?
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.
Any help with this will be appreciated.
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.
Any help with this will be appreciated.
I have not done this with toolbars, but it's very easy to load a dialog button with a bitmap:
hbitmap_start = LoadImageID (ghInstance, IDB_STARTRUN, IMAGE_BITMAP, 0,0,0)
hwndControl = GetDlgItem (hwnd, IDC_STARTRUN)
rval = SendMessage (hwndControl, BM_SETIMAGE, IMAGE_BITMAP, hbitmap_start)
wherein IDB_ is a bitmap created in the resource editor and IDC_ is the id of the corresponding button in the dialog. The above code would be placed under WM_INITDIALOG in your proc's (ie, hwnd in the above) message handler. Also, be sure to invoke DeleteObject (hbitmap_start) when the dialog exits.
If ButtonMessage (BM_) does not work for you as shown, the solution will surely look very similar; check MSDN for toolbar functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dannycat
Can anyone help me on the following?
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.
Any help with this will be appreciated.
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.
Any help with this will be appreciated.
Do you mean these icon next to "Save" or "Print"?

These are .NET components. I dont think, that you can use this IVF. When someone does know, how this can be done, please let us know :-)
Markus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dannycat
Can anyone help me on the following?
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.
Any help with this will be appreciated.
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.
Any help with this will be appreciated.
There is SetMenuItemBitmaps API, but it's only half-useful. Namely, Windows has a peculiar "idea" how to combine the bitmap colors with the menu (white in the .bmp gets gray in the actual image, and so on IIRC), so the end result is not particularly aesthetically pleasing (MSDN says that monochrome bitmaps should be used, but it works with 16 colors). See the attachment for an example (12x12 bitmaps are used, but I don't recall what happens with bigger ones).
The next best thing is to use owner-drawn menus and draw it all by yourself (both the text and bitmaps/icons). It's not particularly difficult to get in a first iteration, but the devil can be in the details, such as underlining Mnemonics, displaying very long strings, and getting it right in with Vista/XP themes... Google "owner-drawn menus" and you'll get several good tutorials.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Follow Juguslav's suggestion, I had located some useful looking code at the following location.
http://www.rocscience.com/~corkum/bcmenu.htmlThis seems to cover what I'm looking for but unfortunately it is written in the form of the C++ object for use with MFC applications. I'm not at all familiar with these concepts so forgive me if I'm asking dumb questions,but here goes:-
1) Cansuch C++ objects be used directly from a fortran windows program? If so how? In general
2) Alternatively can the code be rewritten to be usable in non-object form?
The reason I ask is that the main object "bcmenu.cpp, bcmenu.h" contains a vast amount of code and it would make sense not to rewrite it all again in fortranwith probabilty of introducingbugs etc. Looks a bit daunting for non C++ progammer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have not used this, but.....
you could try using the API function GetMenuItemInfo, which populates a MENUITEMINFO structure for the menuitem, one component of which, FTYPE, when set to MFT_BITMAP,is a flaglets yousignal thatthe menu item should be displayed using a bitmap whose handle is then supplied in another component, DWTYPEDATA. By providing a modified MENUINFOstructure formed by setting FTYPE to MFT_BITMAP, and changing the DWTYPEDATA to point to a bitmap of your choice, you maybe able tochange the handle to a bitmap of your choice by using SetMenuItemInfo along with a pointer to the now-modified MENUITEMINFO Structure. This should then ensure that the menu item is drawn to your own specification. Note that MENUITEMINFO structure also allows you to specify bitmaps to provide your own checked/unchecked marks for each menu item.
you could try using the API function GetMenuItemInfo, which populates a MENUITEMINFO structure for the menuitem, one component of which, FTYPE, when set to MFT_BITMAP,is a flaglets yousignal thatthe menu item should be displayed using a bitmap whose handle is then supplied in another component, DWTYPEDATA. By providing a modified MENUINFOstructure formed by setting FTYPE to MFT_BITMAP, and changing the DWTYPEDATA to point to a bitmap of your choice, you maybe able tochange the handle to a bitmap of your choice by using SetMenuItemInfo along with a pointer to the now-modified MENUITEMINFO Structure. This should then ensure that the menu item is drawn to your own specification. Note that MENUITEMINFO structure also allows you to specify bitmaps to provide your own checked/unchecked marks for each menu item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also found this lengthy MSDN article, but it doesn't make it much simpler.
I find it rather bizarre that they made the menu item icons/bitmaps a de facto standard part of the Windows visual style, but they haven't provided a simple API to attach them. Sigh...
I find it rather bizarre that they made the menu item icons/bitmaps a de facto standard part of the Windows visual style, but they haven't provided a simple API to attach them. Sigh...

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page