Adding an Icon

Let’s start by adding an icon. Load up our HelloWorld project from the last tutorial. Click on Project->Resources. This will bring up the Resources window:

Click the Add button and enter in the following info for our icon. Make sure before you do this you copy the icon (supplied in the download) into the Res folder in your HelloWorld project directory. The name of the icon I included is called “clippy.ico”. If you wish to include your own, be my guest, just make sure it’s an .ico file:

Now we’re going to register the icon with our program. The first thing we need is a global variable for the handle to the icon. Open up HelloWorld.inc and add this line:

Now we need to actually load the icon to assign it to our program. We will need to add the appropriate code to the WM_INITDIALOG section:

Now, after you build the project, you will see that the .exe file that RadASM has created has our new icon:

Adding a Menu

RadASM actually makes it quite easy to add a menu, as it has a menu resource editor built-in:

Clicking “Add new”->”Menu” under the Project menu will display the menu resource editor:

This editor let’s us create single button menus, drop down menus and multi-drop down menus (menus within menus). We’ll create a simple menu bar with two options; “help” and “quit”. These will not have drop-down capability. First, enter the information for the first:

Here, we enter the caption (the part that will be displayed) and the name. As soon as you enter these the item will display in the bottom box. At this point you can delete the item by clicking “Delete”, or you can edit it by just highlighting it in the box.

You also have the options to set the attributes of the menu item (for example, greyed out) and changing the item ID. In our case, we’ll leave it at 10001. You can also set up a hot-key for the menu item by clicking the “Shortcut” spinner. Like all other Windows IDEs, you can enter an ampersand (&) before any letter to make it an accelerator (for example, E&xit makes it so you just have to press the ‘x’ key to trigger the menu item.)

Let’s add our second. Click the empty line below “Help” in the bottom box which gives us a new item to modify:

At this point, if you wanted to insert an item between the two, you would simply highlight the first and click “Insert”. This will insert an empty item between the two.

Another thing you may have noticed are the four blue arrow icons. The up and down icons allow you to change the order of the menu items. The left and right one determine if the menu item is a header or a sub item. For example, let’s add a “File” menu, and when you click this, an additional menu drops from it with the option to “Save”. In this case, we would first create the File name ( at the top by highlighting Help” and clicking the “Insert” button):

We would then create the save item going in this menu by clicking the “Help” item and clicking “Insert”, then inserting the data for save:

Now, higlighting the “save” item and clicking the right arrow key makes this item a sub-menu item of the one on top of it, in this case the :File” header:

Now when we run the app, we see a new menu header with a Save option under it:

Note: For the sake of this tutorial, I deleted the “File” and “Save” menu items.

You will also notice, after clicking OK, RadASM has created our new menu in a .mnu file:

Any time you open this file, the menu editor will appear. If you open this file in Notepad, you can see what’s in it:

Now, when we run our program, we see our menu items automatically appear, Of course, they don’t do anything yet:

We need to add the code to handle he menu’s messages. First, the two lines shown need to be added to the HelloWorld.inc file:

Then we need to add the message handlers into the HelloWorld.asm file:

Notice that, because the menu handlers had to go first, the “.if DX==BN_CLICKED” line was changed to “.elseif DX==BN_CLICKED”.

Finally, we need to add a new string so that our menu does something when you click “About”:

Now when we run our program, we can select our new menu items: