Microsoft Windows

From Simson Garfinkel
Jump to: navigation, search

Windows Development

I'm primarily a Unix developer, but some of the code that I maintain has to run on Windows. Here's a list of useful things for other Unix programmers that are put into this position.

Microsoft VC++
Microsoft makes "express" versions of its Basic, C#, C++ and J# compilers available for free]. Presumably this is to compete against cygwin, which lets you compile and run traditional Linux/Unix free software on Windows. (I don't like using cygwin myself, becuase it requires the use of a special Cygwin DLL, it has traditionally had problems with multi-threading, and there have been performance issues in the past. But for many jobs Cygwin is probably just fine.)
Cryptography on Windows
Windows has a built-in CryptoAPI that can perform most cryptographic functions, but the API is completely non-standard. Microsoft posted an example C program to calculate the MD5 hash of a file using the CryptoAPI. Getting this program to actually compile requires that you install the Platform SDK in addition to the C++ compiler. Successfully linking the program requires information not present on the MSDN web page. I have uploaded the source code and a makefile for Microsoft's NMAKE to this server. However, it's usually easier just to include md5.h and md5.c if that's all you need.
mingw
mingw is a port of the Gnu C++ compiler and tool chain to Microsoft Windows. mingw emits Microsoft-standard .exe files and comes with .h files that are compatible with those that Microsoft ships. You can run mingw directly on Microsoft Windows or you can cross-compile from Linux or Macintosh computers. The advantage of running natively on Windows is that it's easier to debug; the advantage of cross-compiling is that you can run your entire development environment inside Unix, which generally runs faster than Windows on the same hardware.
Cygwin
Cygwin is another way to run Linux software on Windows. Instead of porting the compiler, Cygwin has a POSIX-emulation DLL that allows Unix programs to be run more-or-less natively on Windows. This approach is generally easier to use, because you have real Unix .h files and not Windows .h files, but it requires that you distribute the Cygwin .dll with your program. My experience is that Cygwin programs generally run slower than mingw programs because of the overhead imposed by the POSIX emulation layer.
Once you install Cygwin, use its package manager to install these packages:
    • g++
    • make

Setting up a Windows Development Environment

Download and install the following programs

Avoid

  • putty.exe and pscp.exe (open source Windows versions of SSH and SCP)

SSH, XTERM, and other remote access applications

MobaXterm
http://mobaxterm.mobatek.net This seems to be the best remote access solution for Windows. It includes a command line, SSH, X server, and many other useful resources.
Screen shots on windows
http://stackoverflow.com/questions/997175/how-can-i-take-a-screenshot-and-save-it-as-jpeg-on-windows
http://stackoverflow.com/questions/7292757/how-to-get-screenshot-of-a-window-as-bitmap-object-in-c
http://stackoverflow.com/questions/5610075/taking-a-jpeg-encoded-screenshot-to-a-buffer-using-gdi-and-c
http://stackoverflow.com/questions/531684/what-is-the-best-way-to-take-screenshots-of-a-window-with-c-in-windows
http://stackoverflow.com/questions/2659932/how-to-read-the-screen-pixels
http://www.codeproject.com/Articles/5051/Various-methods-for-capturing-the-screen