Windows API C Calling Convention

Windows API was built more than decade, and most of them using stdcall calling convention. What actually is calling convention and what kind of calling conventions avaiable here?

Calling convention will define how the arguments and return value being passed to and from a function being called.

More info:

Most familiar calling convention: cdecl, stdcall, thiscall, fastcall, and pascal.

CDECL

This calling convention is default C, support variable arguments.

Caller: Cdecl will PUSH arguments from the last to the first, then do CALL which actually doing PUSH return address before JMP to function. Upon return from function the caller must clean the stack.

Callee: Won’t do stack cleaning and return using RET.

Return value will also EAX register.

Also known as caller-cleaned. This way passing more arguments doesn’t matter.

The disadvantage of cdecl is multiple call to the function will increase code size because additional stack cleaning instructions.

stdcall

Monst Windows API Function, Callback Function, and COM Interface Method using stdcall.

Caller: Stdcall will PUSH arguments from the last (arg-N) to the first (arg-0), then do CALL which actually doing PUSH return address before JMP to function.

Calee: Stdcall upon returning will pop the function arguments using RET n

Return value alsa using EAX register. The variable arguments is not available as opposed with stdcall. It is also known as callee-cleanned.

This way caller won’t need to clean the stack and will produce smaller codes when multiple calls to Windows API being made becuse reduce of cleaning instruction on each call.

thiscall

This call usually for C++ method function and similar with stdcall.

The difference is the caller store the this pointer as first argument (arg-0) implicitly using ECX register.

FASTCALL

This calling convention also similar with stdcall, the difference the first argument stored in ECX register the second argument using EDX register.

pascal

This calling convention being used on Win16 era and similar with stdcall as callee-cleaned. The difference is the order of argument being stored start from first argument (arg-0) to last argument (arg-n).

Windows 7 Window with CSS3 and jQuery Tutorial Part 2

Nice to welcome you to the second part of the Windows 7 window tutorial! Today’s continuation is seamlessly linked to the first part of HTML and CSS. After the interface design of a Windows 7 window in the Firefox “Look & Feel” was simulated in yesterday’s first part, in today’s second part JavaScript or the plugin jQuery (UI) will play the main role in this tutorial 2-divider. In particular, a possible modification of the window size (resizable) and position (draggable) by the user is discussed.

Step 1 – Create and reference to JavaScript files

Since we have already implemented a Windows 7 window according to the “design specifications”, but still no “movement” is possible, the necessary javascript files as resources (jQuery & jQuery-UI – lines 4 to 6) For the still pending request, is added to the existing HTML code from Tutorial 1. In the finally given JavaScript file windows7.js (line 7) the functions corresponding to our requirements (step 3 to 4) are defined.

...
<title>Windows 7 mit CSS3 und jQuery</title>
...
<s cript type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<s cript type="text/javascript" src="../js/jquery-ui- 1.7.2.min.js"></script>
<s cript type="text/javascript" src="../js/windows7.js"></script>
</head>
<body>
...

Step 2 – Draggable shift

In order to make the Windows 7 window look and look like a Windows 7 window (draggable) and resizable, the following code must be created in the file windows7.js become. This code causes the already embedded [jQuery UI module dragging] (http://jqueryui.com/demos/draggable/) to be addressed and executed.

$function 
  $".window".draggable 
    cancel: .inhalt,
    containment: body,
    scroll: false,
    stack: group: .window, min: 1 
  ;
;

A brief explanation of what’s going on here:

  • Line 2 – all elements of class window can be moved
  • Line 3 – Elements of class content can not be used for moving
  • Line 4 elements can not be moved beyond the body-tag
  • Line 5 – no scrollbars when a window is pushed out of the body-tag
  • Line 6 – stack causes the currently active window to be placed in the foreground, is only interesting for more than one window

Windows 7 window - Draggable thanks to jQuery UI

So you can now grab the window and move around.

Step 3 – Resizeable – Change of size

The last feature is still missing, the dynamic change of window size. Just below the dragging code within the windows7.js, the following JavaScript code is created.

$function 
  $".window".resizable
    handles: n, e, s, w, ne, se, sw, nw,
    containment: body,
    minHeight: 80,
    minWidth: 138,
    maxHeight: $window.height,
    maxWidth: $window.width
  ;
;

This will now jump to the Resizable Module.

  • Line 2 – all elements of the class window can be changed in their size
  • Line 3 – handles specifies the corners and edges of the window elements to be added to the size change
  • Line 4 elements can not be expanded beyond the body-tag
  • Line 5 to 6 – minHeight and minWidth define the minimum height or width
  • Line 7 to 8 – maxHeight and maxWidth define the maximum height or width (here, equal to the viewport of the browser)

Windows 7 window - resizable thanks to jQuery UI

Step 4 – Resizeable Features designed by CSS

But a little is missing: The elements added by handles, such as the resizeable cursor, etc., still have to be styled via CSS. For jQuery UI there are themes, which of course already include. For our beginners example, the following code, which must be written into the style.css, is sufficient:

.ui-resizable-handle display:block;position:absolute;
.ui-resizable-disabled .ui-resizable-handle,
.ui-resizable-autohide .ui-resizable-handle display:none;
.ui-resizable-n,.ui-resizable-s height:7px;left:0;width:100%;
.ui-resizable-n cursor:n-resize;top:-5px;
.ui-resizable-s bottom:-5px;cursor:s-resize;
.ui-resizable-e,.ui-resizable-w height:100%;top:0;width:7px;
.ui-resizable-e cursor:e-resize;right:-5px;
.ui-resizable-w cursor:w-resize;left:-5px;
.ui-resizable-se,.ui-resizable-sw,
.ui-resizable-nw,.ui-resizable-ne height:12px;width:12px;
.ui-resizable-se bottom:0;cursor:se-resize;right:0;
.ui-resizable-sw bottom:0;cursor:sw-resize;left:0;
.ui-resizable-nw cursor:nw-resize;left:0;top:0;
.ui-resizable-ne cursor:ne-resize;right:0;top:0;

Windows 7 window in different window sizes

Demo

Now we would be at the end, from now your imagination is asked. The strict separation of content and layout allows you to create other themes as well, eg. With windows in Windows 2000 or Mac OSX Style? Or several windows at once? Who of you in the implementation of the two tutorials have done everything right, should have the following representation of a Windows 7 window:

View Tutorial Demo

On my blog I have a demo, Which also pushes the whole thing further: Aero Peek, maximize or close windows, Taskbar and Start menu, to name only a few points. I hope that I can give you some ideas, especially about CSS3, how useful it is, and how it will make it easier to design everyday.

Download

On Norman’s blog you can also get the final result of this small tutorial series as ZIP for download.

Author

This second part of this small tutorial series with the theme “Windows 7 with CSS3 and jQuery” has been posted by the guest blogger Norman Paschke, whom we welcome on this website on the Webstandard blog. Norman studied Applied Computer Science at the Technical University of Chemnitz and started Norman’s blog in early 2009, where he devoted himself to the subject of “Web and Webdesign”. In addition to tutorials, he also developed current trends and developments such as, for example, the Browsermarkt, picks up.

Source:

Windows 7 Window with CSS3 and jQuery Tutorial Part 1

You can find the Interfacedesign of Windows 7 considerable and are interested in CSS3? Then you are exactly right here. This is because in this tutorial 2-divider a window from Windows 7 is created with the help of CSS3 and jQuery UI. The first part of this tutorial is about the styling of the window, according to the “Interfacedesign Preferences” of Windows 7. The second part of this tutorial is about the dragging & resizing of the created window with the help of jQuery UI.

Windows 7 Windows - The original as a template

Windows 7 – The original as a template

So that you know what will be replicated, here is a picture of a window from Windows 7. However, we will only create a simplified window without closing, minimizing and reducing. That There are only three elements with special interfacedesign characteristics, which are of decisive importance for styling:

  • Window frames: transparency, round corners, shadow shadows
  • Windowtitle: Program-Icon, Text-Shadow, Font: Segoe UI
  • Window content: flexible height and width

But this is not enough, if you enlarge the picture like the picture here on the left, you can see that a few small details are missing in the collection. The window frame has a thin black edge to the outside, but also a pale white edge inwards. The same applies to the window content, but here the light edge is logically outside and the dark edge is inside. In addition, it can be seen that the window content at the corners is quite slightly rounded

Step 1 – Create the HTML framework and content

Before we start the window from Windows 7 using CSS, the HTML framework used for this tutorial is shown. It should be mentioned briefly that the headings h1 to h3 (lines 11, 12 and 14) can correspond to a possible web page structure. To handle the semantics of the headlines, the Windows 7 window in this tutorial example gets the h4 tag.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <title>Windows 7 with CSS3 and jQuery</title>
  <link rel="stylesheet" href="css/style.css" type="text/css" />
  <!-- At this point, JavaScript is referenced in the second part of the tutorial -->
</head>
<body>
  ...
  <h1>Headline of your website</h1>
  <h2>Article heading</h2>
  <p>Lorem ipsum dolor sit amet ...</p>
  <h3>Article Subtitle</h3>
  <p>Lorem ipsum dolor sit amet ...</p>
  ...
  <div class="window">
    <h4 class="title">Mozilla Firefox</h4>
      <div class="content">
      <!-- At this point, there is room for your window content -->
      </div>
    </div>
  ...
  </body>
</html>

Explanation: A doctype should be available, which you use, but is left to you of course. Recommended is of course HTML / XHTML Strict to use, but also the new HTML5 Doctype should work here. In the head, you give the link to the used StyleSheet file. In the second part, this tutorial will refer to the JavaScripts used for Part2.

  • JQuery 1.4.2: the latest version of the popular JavaScript framework from the Microsoft server
  • JQuery UI: here, besides the “core”, the Draggable and Resizeable module is important (if you are not sure since you have everything, just download the file from the example)
  • The last file is a blank JavaScript file, which we will fill in part2

Finally, the actual window, consisting of the above three parts (div.window, div.content and h4, which of course must correspond to the structure of your document), is displayed between lines 19 to 24. Particularly important are the class names, then the styling goes on. The class window stands for the window frame to be created and encloses everything else that belongs to the window. The class title is as the name suggests the window title. The class content logically contains all later window contents.

Step 2 – Create and style the window background

Now it’s interesting, because without CSS, we have so far only a white page and a non-saying title “Mozilla Firefox” (or whatever you wrote in the title …). Therefore, the layout for the background of the window is defined below. The background image of a Steinadler by Richard Bartz under Creative Commons also serves to illustrate the effects, such as transparency.

* 
  margin:0;
  padding:0;

html 
  height:100%;
  width:100%;

body 
  background:#eadfcd url(../img/background.jpg) no-repeat 0 0;
  -webkit-background-size:cover;
     -moz-background-size:cover;
          background-size:cover;
  height:100%;
  width:100%;
  overflow:hidden;

In lines 1 to 4, a CSS reset is performed (one can be used another), the page is refreshed to the full screen size, and a background image is still missing (included in the example). The background-size: cover ensures that the background image, regardless of the resolution, is always drawn to the full height and width of the window.

Step 3 – Create and style the window frame

We know what optical features the frame has, this results in the following CSS code, which is spiked with several CSS3 properties.

.window 
  -webkit-border-radius:7px;
     -moz-border-radius:7px;
          border-radius:7px;
  -webkit-box-shadow:0 0 0 1px #eee inset,
                     0 0 15px rgba(0,0,0,0.9);
     -moz-box-shadow:0 0 0 1px #eee inset,
                     0 0 15px rgba(0,0,0,0.9);
          box-shadow:0 0 0 1px #eee inset,
                     0 0 15px rgba(0,0,0,0.9);
  background-color:rgba(160,160,160,0.4);
  border:1px solid #000;
  height:146px;
  left:555px;
  padding-bottom:46px;
  position:absolute;
  top:125px;
  width:389px;
  • Line 2-4: Round corners through border radius (for Gecko, Webkit and the normal syntax)
  • Lines 5 to 10: thin pale white border inside, black shadow outside
  • Line 11: transparent background color by RGBa
  • Line 12: thin black border
  • Line 15: the padding is needed, so that we can later draw the window contents to the full size
  • Line 16: is necessary for positioning
  • height, left, top and width can be selected as desired, they are only used to initialize the size and position of the window

The current state of affairs would now be a transparent, but still “empty” window without any text and image contents. So, let’s go!

Windows 7 - Transparent window

Step 4 – Styling the window title

In the next step we will devote ourselves to the title area of the window, which includes a favicon in addition to the stylistic award of the title. In this case, the Mozilla Firefox browser is used. The font family is based on the family Segoe UI developed by Microsoft for the operating systems Windows Vista and Windows 7.

.window .title 
  background:transparent url(../img/firefox_favicon.png)
  no-repeat 6px 6px;
  color:#000;
  cursor:move;
  font:normal 12px/16px "Segoe UI",Arial,sans-serif;
  height:16px;
  overflow:hidden;
  padding:6px 0 6px 28px;
  text-overflow:ellipsis;
  text-shadow:0 0 1px #fff,
              3px 3px 5px #fff,
              -3px -3px 5px #fff,
              -3px 3px 5px #fff,
              3px -3px 5px #fff;
  white-space:nowrap;
  • Lines 2 to 3: Program icon, here goes every 16×16 pixel picture
  • Line 5: Cursor becomes a cross, which indicates that you can push it around (according to part 2;))
  • Line 6: Font size and family (with fallback, if first font family does not exist)
  • Line 10: A CSS3 property currently supporting only Chome. Text that is longer than the element is truncated with three points
  • Lines 11 to 15: Text-Shadow, so that the text remains legible on the transparent frame
  • Line 16: Text is not wrapped if it is longer than the element

Well, we are approaching our goal …

Windows 7 - Transparent window with Firefox icon and title

Step 5 – Create and style the window contents

In the next step, we will focus on the content area of the Windows 7 window. This gets assigned to a barely visible but a pixel border radius, as well as appropriate shadow and background properties.

.window .content 
  -webkit-border-radius:1px;
     -moz-border-radius:1px;
          border-radius:1px;
  -webkit-box-shadow:0 0 0 1px rgba(255,255,255,0.65);
     -moz-box-shadow:0 0 0 1px rgba(255,255,255,0.65);
          box-shadow:0 0 0px 1px rgba(255,255,255,0.65);
  background-color:#fff;
  border:1px solid #666;
  color:#000;
  font:normal 12px/18px arial,sans-serif;
  height:100%;
  margin:0 6px;
  overflow:auto;
  padding:5px;
  position:relative;
  • Lines 2 to 4: slightly rounded corners
  • Lines 5 to 7: thin white border on the outside
  • Line 12: Contents must be reeled to the full height of the frame
  • Line 14: Content that goes beyond the element can not be displayed; instead, scrollbars appear at the edges of the element

The CSS work carried out in this step now results in the state which corresponds to our initial task.

Windows 7 window including content

Step 6 – Content is the King!

As is known as Content the King, the window can now be filled with further content (of your choice).

...
<div class="content">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
<p><img alt="Musterbild" src="img/oops.png" /> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
...
</div>
...

Since the text and image contents are too large for the window size, the scroll bar appears. The contents of the scrollbar can then be accessed as in a “real” Windows 7 window.

Windows 7 window in browser comparison

Browser Compatibility

A question which will arise in particular due to the used CSS3 features some of you, is the browser compatibility of this tutorial example. And to get an idea of how this window looks in the other browsers, here is a small preview in the latest versions (FF3.6, Opera10.5, IE8, Safari4, Chrome4):

Browser comparison - FF3.6, Opera10.5, IE8, Safari4, Chrome4 (from the left)

As you might have guessed, the Internet Explorer (8) does not support any of the CSS3 properties used in the Internet Explorer 9 Preview, as does Safari still has its problems with box shadow, where inset occurs. Chrome has a small rendering bug: with border radius in the interplay with box shadow, unsightly light gray corners occur. Only Firefox and Opera render in this tutorial everything, as it corresponds to the task position.

Windows 7 Window with CSS3 – The Demo

Sure, there are also a number of workarounds and fallbacks for the less mature browsers, but they should not be the content of this tutorial. Rather, the first part of this Turorial will show what will be possible with CSS3 in everything. Until all browsers are on the same level, the example could serve as small CSS3-Testsuite. 😉

View Tutorial Demo

In the second part you will learn how to use jQuery UI to move the window and resize it. I thank you already for the attentive reading, thank you! 🙂

Author

The author has written this first part of this small tutorial series of the guest blogger Norman Paschke, which we welcome over this way on the Webstandard blog. Norman studied Applied Computer Science at the Technical University of Chemnitz and started Norman’s blog in early 2009, where he devoted himself to the topics of “Web and Webdesign”. In addition to tutorials, he also presents current trends and developments such as, for example, the Browsermarkt, picks up.

Source:

Ruby on Rails using Native Windows

Reasons

  • Some people still using Windows platform for their works, so our ruby application should run on it.
  • Our first alternative is Cygwin, but it’s not native windows, using lot of packages, and ruby run slow.
  • Mixing precompiled ruby with other precompiled extensions, and compiling the extension our self.

Using Precompiled Ruby:

You can obtain ruby by downloading Ruby on Windows for newer binary version (ex: 1.8.7). Then you need Instant Rails just only to get the extensions’ shared library (such as zlib.dll, readline.dll, etc.) and also to get common useful gems. If you need MySQL, get it from XAMPP.

Put Them All

NOTE: If you want to compile Ruby from scratch then skip this section.

Extract Ruby 1.8.6 patch 114, for example to c:\ruby**. So there is a ruby interpreter that resides in **ruby\bin folder. Next, extract InstantRails-2.0-win.zip to c:\tmp\instantrails. We will need prebuild extension libraries. Copy all extensions shared-library (*.dll) files from instantrails\ruby\bin to our ruby\bin folder, they are: zlib.dll, readline.dll, iconv.dll, libeay32.dll, ssleay32.dll.

Insert c:\ruby\bin path to your system PATH environment variable from System Properties on Control Panel. And then go to command prompt and type irb. If irb running and you can press up or down to select history, then all above steps are complete! Congratulation!

Compiling Extensions

For compiling ruby extension using native windows, using Visual C/C++ 7.1 (VS .NET 2003) compiler and Visual C/C++ 6.0 (VS 6/2000) library is recommended.

Why? I prefer VC7 compiler because it fast, good optimization, support new assembly (maybe you don’t need it), and also it have free version called Express Edition (it seems no longer available to download for older version). Just until I write this post, almost precompiled extension was built using Visual C/C++ 6.0 Library called msvcrt.dll not msvcr71.dll. And also the precompiled ruby still using VC6 library.

How to obtain them? Just ask Microsoft, or ask om Google (googling), torrent, or find who share (sell, I mean) them. But i’am not sure you can find them available for download. You should check the CD Software’s store.

Mixed Visual Studio Environment Variables

You will need to modify VC7 vcvars32.bat for using VC7 as compiler and tools and pointing the library to VC6. Change the line that tell INCLUDE and LIB environment variable with value just like VC6 vcvars32.bat. Save the batch file to c:\vcvars76.bat and run it once each you enter command prompt before you start compile anything.  You only need to change the vc7_install_dir and vc6_install_dir  variables, there is the file:

@set vc7_install_dir=c:\Program Files\Microsoft Visual Studio .NET 2003
@set vc6_install_dir=c:\Program Files\Microsoft Visual Studio
@set path_before=%PATH%
@call "%vc6_install_dir%\vc98\bin\vcvars32.bat"
@set PATH=%path_before%
@set path_before=
@set include_before=%INCLUDE%
@set lib_before=%LIB%
@call "%vc7_install_dir%\vc7\bin\vcvars32.bat"
@set INCLUDE=%include_before%
@set LIB=%lib_before%
@set include_before=
@set lib_before=
@set vc7_install_dir=
@set vc6_install_dir=
@echo Done.

Fixing _ftol2 Function

The VC 7 compiler uses _ftol2 function for converting floating point to integer number. But the VC 6 library only have _ftol function to do this, so the generated linking error will comes up. So, you need to include the _ftol2 in your source, which will redirect the call to _ftol. Put this file vc6vc7lib.c on the extension source, and run ruby extconf.rb to generate the Makefile, and follow the extension’s instruction. This is the file:

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
// VC7 or later, building with pre-VC7 runtime libraries #if defined(__cplusplus) extern "C++" { #endif
extern long _ftol( double ); // defined by VC6 C libs
extern long _ftol2( double dblSource ) { return _ftol( dblSource); };

#if defined(__cplusplus)
}
#endif

#endif

Compiling Ruby from scratch

REFERENCE: Ruby-mswin32 How to Install.

Download the ruby source, I’m using Ruby 1.8.6 patch 114 source. You also need others GNU library as extension for ruby. Here is a list of minimal library (mswin32 version) you will need:

  1. Zlib 1.1.4 or Zlib 1.2.3 (required for compressing)
  2. Readline 4.3.2 (required by irb)
  3. OpenSSL 0.9.8 (required for SSL/TLS encryiption)
  4. Iconv 1.8 – brokenlink? or LibIconv 1.9.2 (required for character encoding)
  5. PDCurses (optional, for curses)
  6. GDBM (optional, GNU dbm)

NOTE: If those links invalid you may find them from: GnuWin32

Extract all files to somewhere and put them to same folder by its time. For example, you create the folder c:\gnuwin32\bin to put all bin (precompiled such as .dll, .so), then you have folder c:\gnuwin32\lib to put all lib (library files with ext .lib, .a) . Next you have a folder c:\gnuwin32\include to put all include files with ext .h. You must  also preserve the directory structure, so you must have a folder c:\gnuwin32\readline and c:\gnuwin32\openssl. Then you must set the environment variables to include these folders, you can save it to file gnuwin32vars.bat, and there is the content:

@set INCLUDE=%INCLUDE%;c:\gnuwin32\include
@set LIB=%LIB%;c:\gnuwin32\lib
@set PATH=%PATH%;c:\gnuwin32\bin

Enter the win32 folder in the ruby source code folder (eg. C:\ruby-1.8.6-p114\win32). You can read README.win32 file for further step by step guide compiling Ruby on Windows using MS Visual C++. From win32 folder create build folder, then enter the this folder (eg. C:\ruby-1.8.6-p114\win32\build). It is the where the intermediate object files created, and to make win32 folder stay to clean.

Compiling Using VC7 but VC 6 Library

NOTE: If you want using same library as compiler, then SKIP this section to NEXT section.

Put the file vc6vc7lib.c to ruby source code folder. Then edit the common.mk file within ruby source code folder. Add the following lines, search for near the beginning of file:

OBJS = array.$(OBJEXT) \
  bignum.$(OBJEXT) \
  ....
  version.$(OBJEXT) \
  vc6vc7lib.$(OBJEXT) \
  $(MISSING)

Then, search for these lines near the end of file:

version.$(OBJEXT): {$(VPATH)}version.c {$(VPATH)}ruby.h config.h \
  {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
  {$(VPATH)}version.h
vc6vc7lib.$(OBJEXT): {$(VPATH)}vc6vc7lib.c

dist: $(PROGRAM)
  $(RUNRUBY) $(srcdir)/distruby.rb

Then save it.

Compiling Using VC 6/7

If you want to using same library as compiler (eg. VC7 compiler with VC7 lib, or VC6 compiler with VC6 lib) then don’t forget to run vcvars32.bat within Microsoft Visual C++ folder. But if you compile using VC7 but VC 6 Library, you should consider previous section, then run vcvars76.bat.

Don’t forget to run gnuwin32vars.bat, so the ruby extension will also built. Within the build folder, to create Makefile, type:

..\configure.bat i686-mswin32

For createin binary files, type:

nmake

For testing, type:

nmake test

For installing it to specified folder, type:

nmake DESTDIR=c:\ruby-1.8.6 install

Compiling Ruby Gems

Extract rubygems source, then go to command prompt, and enter rubygems source directory. You can follow rubygems installation instruction in the README file. You should add ruby binary folder to PATH environment to call ruby from everywhere. For example:

@set PATH=%PATH%;c:\ruby-1.8.6\bin

Then type:

ruby setup.rb

Compiling RMagick 2

Install ImageMagick Q8 Windows DLL (with update executable search path, and development headers and libraries), extract RMagick 2 source, edit ext\RMagick\extconf.rb and remove/comment the lines that blocking mswin (it tell us to download the -mswin32.gem), copy vc7vc6lib.c to ext\RMagick, then go to command prompt, run vcvars76.bat, go to RMagick 2 source directory, and follow RMagick installation instruction.