This page explains how to compile AltDrag. There are two distinct parts that you have to compile separately, the 32-bit part and the 64-bit part.
I recommend that you build AltDrag in WSL.
The Windows Subsystem for Linux is a new feature in Windows 10. First open the Microsoft Store app and install Ubuntu.
Once installed, launch the terminal and run the following commands:
sudo apt update
sudo apt install gcc-mingw-w64 nsis
# if you wish to put the source code on your desktop, then first navigate there:
cd /mnt/c/Users/your_username/Desktop/
git clone https://github.com/stefansundin/altdrag.git
cd altdrag
# developer build:
./build.sh
# release build:
./build.sh release
In the Cygwin installer, install the following packages:
git
mingw64-i686-gcc-core
mingw64-x86_64-gcc-core
Once installed, open the Cygwin terminal and type:
git clone https://github.com/stefansundin/altdrag.git
cd altdrag
./build.bat x64
explorer .
This should get the source code and build all the binaries. The last command should open the explorer window so you can see if you find:
AltDrag.exe
hooks.dll
HookWindows_x64.exe
hooks_x64.dll
You can also run ./build.bat run
to automatically launch AltDrag after it has been built.
If you want to build the installer, you need to download NSIS Unicode. Put NSIS in PATH (restart your terminal to update PATH), and then run ./build.bat all x64
to build the installer.
The configuration window was made with ResEdit, a compact resource editor. ResEdit is not needed to build AltDrag.
To configure ResEdit to use cygwin’s mingw-w64 header files, add C:\cygwin64\usr\i686-w64-mingw32\sys-root\mingw\include\
to your include paths.
Run ./build.bat lang
to generate strings.h
files from Translate.ini
files. This is used to hard-code new translations before a release. New languages have to be added to import_languages.c
to be generated.
If you do not want to use Cygwin, you can get mingw-w64 and Git standalone:
If you have trouble downloading the AltDrag source code with git, then you can download a zip file instead.
After downloading the compilers, you need to add them to the PATH variable so the build script can use the them. Do this by right clicking on the Computer desktop icon, go to the Advanced tab, press the Environment variables button, locate the PATH variable and add <mingw-w32 path>\bin
to the list, and press ok on all the dialogs. If you want to build the 64-bit part, add mingw-w64 to the PATH as well.
Here is an example of my PATH variable: C:\mingw-w32\bin;C:\mingw-w64\bin
Now open cmd.exe
and go to AltDrag’s directory. If you had the terminal open when you changed the PATH variable, you must restart it.
The 32-bit part is AltDrag.exe
and hooks.dll
. To compile them simply run build.bat
. It’s convenient to run build
in a terminal so you can see any error messages.
The 64-bit part is HookWindows_x64.exe
and hooks_x64.dll
. These files are only used if you enable HookWindows and are running x64. They need to be 64-bit so that they can hook into 64-bit processes. To compile them you must use mingw-w64. Run build x64
to build the files.
Note that AltDrag.exe
and hooks.dll
are not supposed to be compiled as 64-bit programs. You still need a 32-bit component to be able to use HookWindows for 32-bit processes, and because there is a prevalence of 32-bit programs that we use even on 64-bit Windows, it doesn’t make sense to make AltDrag 64-bit only (yet).
Post in the discussion forum to suggest improvements to this page.