b374k
v10
today : | at : | safemode : ON
> / home / facebook / twitter / exit /
name author perms com modified label

Translate

Showing posts with label Guide to RadASM. Show all posts
Showing posts with label Guide to RadASM. Show all posts

"Guide To RadASM" Adding an Icon and Menu Unknown rwxr-xr-x 0 18:06

Filename "Guide To RadASM" Adding an Icon and Menu
Permission rw-r--r--
Author Unknown
Date and Time 18:06
Label
Action

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:

"Guide To RadASM" Creating Our First Project Unknown rwxr-xr-x 0 18:04

Filename "Guide To RadASM" Creating Our First Project
Permission rw-r--r--
Author Unknown
Date and Time 18:04
Label
Action

Creating Our First Project

Let’s create our first Windows program. Select “New Project” from the File menu. This brings up the New Project Wizard:
The assembler drop down lists all of the various languages we installed at the beginning. In my case, I only have one: Masm.
The project type allows you to designate what type of project we will be making. Setting the different types allows RadASM to pre-make some files for you, along with setting certain settings that go along with your program type. For example, if you select “Dll Project”, files will be created to help set up DLL exports and such. For our first program, let’s keep it set to Win32 App. Type in a name in the Project Name field. I entered “HelloWorld”. The other fields can be left blank. Click “Next”.
Next is the template selection screen:
Templates allow you to pre-populate files with code templates. RadASM comes with several templates for Win32 applications, or you can write your own and save them. The “DialogasMain sets up a project using a dialog as the main screen. The Win32exe sets up a project with a single window but more callback message handlers. For now, select the “DialogApp.tpl” template and click “Next” This will set up  a simple window project.
The next screen is the Files and Folders screen. this screen allows you to choose some files and folders you would like the program wizard to create for you. For example, if programming a Win32 application, we will probably want a resource file (.rc) as well as an include file (.inc). The Bak, Mod and Res options are for creating folders, so if you like to keep all resource objects in a Res folder, keep this highlighted. The Bak folder is a place to store backups of your project. Just leave everything as it is and select “Next”:
Finally, we reach the Make screen. This allows us to change the command line options, debugger, and the options we would like displayed on the “Make” menu drop-down. A lot of this is more advanced, so just leave everything as it is and click “Finish”.
You will see that RadASM has created several files for us already:
Let’s take a look at what files RadASM has created. First, double-click the HelloWorld.Asm file. This opens the code in the main window:
As you can see, RadASM has set up a skeleton app that displays a dialog, and has areas we can enter code for some basic message handlers. Next, let’s look at the HelloWorld.Inc file:
Here we have some basic includes, an ID for the dialog and a dword space set up for the instance handle. Now let’s look at HelloWorld.rc (skipping the .dlg file for a moment):
This just contains an include so we can have our .rc file in a folder (Res). Lastly, double-click the HelloWorld.dlg file. This opens the Dialog Editor:
Notice we have a toolbar along the left-hand side. This is for adding elements to our dialog. This screen is also for changing attributes and IDs of our various dialog controls.
Now let’s run our new program. You can either build the target in steps (ie. assemble, link, run) or you can do everything in one step. These options are on the “Make” menu drop-down. Clicking “Go” assembles, links and runs the program. “Run” can be selected if you are re-running the app (after it has already been built). Also remember, any time you change the resource file you must rebuild it by selecting “Compile Resource”, though clicking “Go” will do this automatically.
Go ahead and select “Go” or click the appropriate toolbar button. If a dialog pops up asking if you want to accept the command, select the check mark “Don’t ask again” and click OK. Now our app’s dialog should appear:
Not a lot to it, though this is only a template. Let’s spice it up a little…

Creating Some Controls

Let’s spiff up our dialog a little by adding some buttons and bitmaps. First we’ll add the buttons. Double-click on the HelloWorld.dlg file to open the dialog editor. Next click on the button tool in the dialog editor toolbar (it says “OK” on it). If for some reason the toolbar is not displayed, click on the little hammer and wrench icon on the main toolbar to display it. Then, click and drag a button in the bottom left-hand corner of the dialog:
RadASM will automatically name this button IDC_BTN. Now we want to change the attributes of this button, so while the button is highlighted, you will see the attributes in the bottom right of the RadASM window:
I have changed the caption (the text in the button) and have changed the button to display multiple lines. You will see the new caption show up in the button:
Now add another button on the right-hand side in the same way, setting it’s attributes to the following:
and the buttons will update in the dialog editor:
Now if you build and run the app, you will see our new dialog. Of course the buttons won’t do anything yet:
Next let’s add some pictures. Like any Windows application, we must load in the bitmaps as resources. Clicking the Resources option in the Project drop-down menu, we will be presented with the resource import screen. To add a new resource, simply click the Add button and fill in the information. When you get to the “file” column, click the three dots and drill to the resource folder and select the appropriate bitmap.
*** You should copy the bitmaps into the Res folder of your project. The bitmaps are available in the download of this tutorial. ***
Notice I named the bitmaps IDB_BITMAP1 and IDB_BITMAP2. We will refer to these IDs later. Now, select the Image tool (the icon with the red “RA” in it in the dialog editor toolbar), then click and drag an image like I have done here:
Now we need to change the attributes of this image, pointing it at our resources we loaded earlier. For the ID number, I entered 105. We will refer to this ID in the HelloWorld.Asm file. I changed the name to match the name we gave our first resource in the resource import screen, IDB_BITMAP1. I added a border, changed the width and height to match the dimensions of the actual bitmap, and changed the type from “Icon” to “Bitmap”:
The image should appear in the dialog editor. Now go ahead and add another exactly as we did the first but this time on the above the Angelina Jolie button, naming this one IDB_BITMAP2 and changing the other attributes to match these:
You should see both images, along with our buttons in the dialog editor now:
Building and running the app shows us the fruits of our labors:
Now we must add the code to handle the events of clicking on the buttons. First, we will add the message handler for the two buttons. Load the HelloWorld.Asm file into the main window. We will make it so clicking on a button will display a message box. I will define the text strings for the message box in the next step:
Notice that eax is compared with the ID we gave the buttons, IDC_BTN1 and IDC_BTN2.
Now we can add the text strings to the top of HelloWorld.Asm:
Finally, we have to add the IDs we created for the buttons in the HelloWorld.Inc file:
Running the app now displays our wonderfully compelling and useful app:

"Guide to RadASM"Installing and Set Up Unknown rwxr-xr-x 0 18:01

Filename "Guide to RadASM"Installing and Set Up
Permission rw-r--r--
Author Unknown
Date and Time 18:01
Label
Action
RadASM is a very good IDE (Integrated Development Environment: think Visual Studio) for developing in most programming languages, though assembly language is where it shines. Not only is it one of the few IDEs out there that will work with assembly language, but the author has also put a significant amount of time and effort into it, making it extremely feature rich and robust. Many people use inline assembly in Visual Studio (using __Asm directives) but you really can’t get the level of control in these big-name IDEs as you can in this product. I used WinASM, a very good product, for years, but when I finally tried RadASM, it felt like someone had created it that really knew assembly language, and the hardships that can bring.
In this series of tutorials I will go over installing RadASM, running it, and creating programs in it, as well as some additional plugins and features. In the download for this tutorial (available on the tutorials
page) I have included all of the installation files for RadASM, as well as the Masm SDK, providing everything you need to program in assembly language. So let’s get started.
Please keep in mind that this is not an assembly language nor a Windows programming tutorial. It is assumed that both of these have already been learned. If you are rusty (or a beginner) I highly recommend the Windows assembly tutorials by Iczelion. Fortunately, they are also based on RadASM, so the transition should be very easy.
http://www.woodmann.com/RCE-CD-SITES/Iczelion/index.html

Installation

The first thing we need to do is install Masm onto our computer. Masm is the actual compiler (the same one Visual Studio uses) and has been around a very long time. There is an install.exe file in the Masm32v11r.zip file included in this download. Unzip it and run it- it will automatically install Masm onto your computer. I suggest, in order to eliminate problems in the future, you simply install it into it’s own folder in your root folder on your drive, for example “C:/MASM”.
Now we need to install RadASM itself.
The first file we need is RadASM.zip. This is the main IDE files. Copy these into a new folder. This will now be your root install directory, so you may want to copy this folder in to your Program Files folder, make a shortcut etc.) Next we need to add support for Masm (or TASM, GoASM or nASM). As RadASM is a generic IDE, and works with pretty much any language you can throw at it, we need to give RadASM the specific details about the assembly language we’ll be using.
Open the Assembly.zip file and copy the appropriate folder to the root folder of the RadASM installation. I copied the Masm folder, as that’s the type of assembly I work in (and most others do as well). If you wish to work in one of the other languages, you can copy those as well. We also need to copy the associated .ini file in the root folder as well, in my case Masm.ini. Finally, copy the appropriate .ct and .kwl files into the addins folder in the root of the RadASM folder.
Next, copy the RadASM.chm help file into the Help folder in the RadASM root installation folder. Now, when you click “Help”->”RadASM” in the IDE, this help file will be displayed.
“RadLanguages.zip” contains additional languages (besides English) if you wish to have the IDE in a different language. It defaults to English.
Finally, as you are probably just getting started with assembly language, you can copy the “Demos.zip” and “Games.zip” contents into a Demo folder in the root installation folder. This will give you plenty of examples to look at.

Setting Up the Environment

Now run RadASM and you will see the basic layout:
First things first,  select Options->Programming Languages. Click the “…” button, select the Masm.ini file and hit the “add” button. Masm should now appear in the list of languages. If you have a different assembly type (or want to add additional types) like Tasm or GoASM,  repeat the process for each one. Then click OK. You now have support for that particular language:
Now, you may want to open up any project just to see the color scheme. Here, I loaded the “DragNDrop” project from RadASM root/Masm/Projects/DragDrop. The project file ends with a .rap. You will see the project in our Project Explorer on the right:
Now double-click on the DragDrop.asm file to open it in our code window:
as you can see, the default color scheme leaves a little to be desired. I personally can’t even see the dark blue text, though I am getting old, so what can I say. Let’s change the color scheme to something a little softer on the eyes. Select “Option”->”Color & Keywords”. This brings up the main color selector:
I don’t know about you, but I like to personalize my coding environment. his window allows you to do just that. The method to change colors starts with a theme. There are a couple that come with RadASM and if you look really hard, you can find some additional ones online. But since EVERY option (and I mean EVERY) is changeable, you really won’t need one. I started with the default theme, Dark Night, and modified it from there. If you prefer a lighter background, try one of the other themes. Just select it and click “Load”, the n”Apply” and you will see it pop up. Start with whatever theme is closest to what you like, then you can fine-tune it from there.
To fine-tune it, we go to the Colors and Syntax box below. Here, we choose any type of instruction and select a color for it. You can either select a default color under the Colors group, or you can double-click the type in the Syntax group and select any color you want. For example, if I write a quick comment in the code:
and decide I would instead like it green, I would open the color picker, double-click “Comment” under the Synatx group, and pick a nice green. Clicking Apply will then show me the results:
Because there are so many options that can have their colors changed, a lot of times I will simply look for a color I don’t like in the Syntax group and then change it. Eventually, you will learn what each group type is, or through trial and error will figure it out. After selecting the color I prefer, I now have my own color scheme:
If one of you reading this tutorial would like my exact colors (or want to trade with someone else), you can open the RadASM.ini file provided in this download and copy everything under the “[Colors]” section into the RadASM.ini file in your root folder, replacing what you have with what you copied. Your colors will then match mine exactly.
The last thing I like to do is change the default font. I find the default one a little blocky, so I have included a font designed for assembly language users in mind (I don’t know if this is true, but it sure is a lot better than the default.) It is called Dina, and is in the download with this tutorial. Just unzip the contents and copy them in to the Windows font folder, re-run RadASM, and select “Option”->”Font options”. Now, select the installed Dina font for the first three:
Some other configuration in the Option menu you may want to look at are the following:
  • Languages: Changes the IDE language (if you prefer German, for example)
  • Programming Languages : Adds new templates for additional programming languages.
  • Code Editor Options: Change tab stops, backup policies etc.
  • Dialog Editor Options: For changing the look of dialogs in the Dialog Editor.
  • Menu Accelerators: For adding your own hot-keys.
  • Addin Manager: For adding and deleting addins.

The Toolbar

Depending on which addins you have installed, the addins icons at the right-hand side may be different, though Notepad and Windows Calc will always be the first two icons.
One interesting feature that should be pointed out is the “Tabs” button. This opens the Tabs toolbar:
 

Jayalah Indonesiaku © 2010 SouthGrinder Hacker
VB (Vio b374k) Template design by p4r46hcyb3rn3t