Here's a list of instructions that I have pieced together based on installing
Microsoft Visual C++ 2005 Express Edition and using it to compile AutoHotkey on
XP Pro SP2 and
Vista Home Premium).
Note: The files in the steps listed were from an XP Pro SP2 installation. Other Win versions may have different downloads (Vista does). Please check the system requirements for the downloads if you are not sure.
If you had previously gone through the steps to get Microsoft Visual C++ 2005 Express Edition installed and don't want to through the steps listed below to manually make the necessary modifications then you can download modified sln and vcproj files for version 1.0.46.16 in a zip file. After downloading and extracting the AutoHotkey source files, extract the 2 files in the zip file, replace the 2 existing project files and open the sln file in VC++. The conversion wizard will still start but after completing the wizard (and copying upx.exe to the source directory if necessary) AutoHotkey should compile ok. If anyone decides to try this method then please let me know if it works ok for you.
Modified sln and vcproj files for version:
1.0.47.01
1.0.46.17
1.0.46.16
Install and configure Microsoft Visual C++ 2005 Express Edition
Download and install - Visual C++ 2005 Express Edition (install the IDE if asked)
http://msdn.microsoft.com/vstudio/express/downloads/
Download and install - Microsoft ® Windows Server® 2003 R2 Platform SDK Web Install
http://www.microsoft.com/downloads/deta ... laylang=en
Download and install - Microsoft® Visual Studio® 2005 Express Editions Service Pack 1
http://www.microsoft.com/downloads/deta ... laylang=en
Important: go to
http://msdn.microsoft.com/vstudio/expre ... usingpsdk/ and follow the directions in Step 4 to update the
corewin_express.vsprops file.
Open Visual C++ and go to
Tools->Options->Projects and Solutions->VC++ Directories
On the right there will be a list of paths. There is also a drop-down list on the top right (
Show directories for:)
Make sure to fill in the correct paths for the paths for the Executable files, Include files, and Library files sections. To change a path, double click the path in the list then click ... on the right to navigate to the path requested. When finished entering the paths, click
Ok
Here's an example of what the modifed sections might look like:
Load, Configure and Compile AutoHotkey Source
Go to
http://www.autohotkey.com/download/ and download the latest AutoHotkey source code (
note: version 1.0.46.15 was used in this example)
Run the downloaded file and unzip the project into a new folder in your
/My Documents/Visual Studio 2005/Projects/ folder
(example:
C:\My Documents\Visual Studio 2005\Projects\ahksrc104615)
Go to
File->Open->Project/Solution... in VC++ then browse and open the
AutoHotkey.sln file in the source folder where the AutoHotkey source was extracted. That will start a Conversion wizard. Click Next to proceed and convert the project. Since I still have the original from the download, I chose no when asked if I wanted to create a backup. Once the project has finished converting, a report can optionally be displayed. AutoHotkey.sln should show that it was converted successfully and the AutoHotkey and lib_pcre Projects should have a list of conversion issues.
In the Solution Explorer pane (on the left in the IDE), browse to the file
stdafx.h and double-click on it to open the file in the right pane
on the line below the existing line
Code:
#define WIN32_LEAN_AND_MEAN
add the following line:
Code:
#define _CRT_SECURE_NO_DEPRECATE
then save the file (use the save icon at the top left - 4th from the left - in the IDE).
In the file menu:Navigate to
Build->Configuration Manager and change the
Active solution configuration to
Release using the drop-down list provided then click
closeNext, Navigate to
Project->AutoHotkey Properties...Under
Configuration Properties->C/C++->Precompiled Headerschange
Create/Use Precompiled Header to say
Create Precompiled Header (/Yc)Under
Configuration Properties->C/C++->General change
Treat Warnings As Errors to
NOUnder
Configuration Properties->C/C++->Advancedchange
Omit Default Library Names to
Yes(/ZI)Under
Configuration Properties->C/C++->Advanced change
Calling Convention to something else then change it back to
_cdecl(/Gd)Under
Configuration Properties->Linker->Inputremove
LibCMT; from the
Ignore Specific Library line
Under
Configuration Properties->Linker->Optimizationchange
Link Time Code Generation to
Use Link Time Code Generation (/ltcg)(
note: these settings will likely need to be changed for each solution configuration - Debug Release, SC, etc... if you change to use a different Active solution configuration later)
Open Notepad and edit the file
AutoHotkey.rc in the /source/resources/ folder in the AutoHotkey source directory. Look for the line
Code:
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "AutoHotkey.exe.manifest"
and change it to
Code:
// CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "AutoHotkey.exe.manifest"
then save the file and close Notepad.
In the Solution Explorer pane on the left in the IDE in the /Source Files folder, browse to
script_autoit.cpp and double-click to open it in the right pane. In the file menu: navigate to
Edit->Go To... then type in
1785 for the line number and click
Ok. Change line 1785 from
Code:
lpTemp = strchr(szDest, '*');
to
Code:
lpTemp = (char*)strchr(szDest, '*');
then save the file (use the icon at top in the IDE...)
Go to
http://upx.sourceforge.net/ , download the
win32 console version of
UPX version 3.00 , then extract
upx.exe to the AutoHotkey source folder
(to the same folder as
AutoHotkey.sln) or to a system path.
Finally, in the file menu of the IDE, navigate to
Build->Build Solution (or to
Build->Rebuild Solution if you had preiously attempted to build AutoHotkey) and compile AutoHotkey
If all goes well the end of the output should be similar to:
Quote:
Finished pass 2
Embedding manifest...
Performing Post-Build Event...
Ultimate Packer for eXecutables
Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
UPX 3.00w Markus Oberhumer, Laszlo Molnar & John Reiser Apr 27th 2007
File size Ratio Format Name
-------------------- ------ ----------- -----------
536576 -> 254464 47.42% win32/pe AutoHotkey.exe
Packed 1 file.
Build log was saved at "file://c:\My Documents\Visual Studio 2005\Projects\ahksrc104615\Release\BuildLog.htm"
AutoHotkey - 0 error(s), 16 warning(s)
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========
If everything went ok, the compiled file will be in the
/Release folder in the Project directory (example:
C:\My Documents\Visual Studio 2005\Projects\ahksrc104615\Release)
If AutoHotkey doesn't compile ok then I may have missed adding a step or two in the steps above. Please let me know if that seems to be the case and/or if something needs clarification so that I can update this post.
If you're having difficulties or have questions then feel free to ask.
Thanks. Enjoy
Edit: corrected typo: stafx.h should have been stdafx.h