Resource Editing for Visual Studio Express
Microsoft provides several "Visual Studio Express" tools for free download. These are slightly limited versions of their popular development tools for C++, C#, and Visual Basic.
I enjoy having these tools for free, and most of the missing features I don't notice. Except for one: resource editing. If you want to add icons or menus to your C++ programs, you'll have to manually munge up an RC file. Or do you?
I went looking for an open source resource editor. Of course, I could just break down and install my real copies of Visual C++ or even break out some other commercial resource editors I have, but I wanted a free solution to go along with the free Visual Studio Express product.
I looked pretty hard and I couldn't find a single tool that did what I wanted. However, I did find two tools that together would do the job.
The first tool is the excellent
XN Resource Editor. What doesn't this tool do? It will create menus, icons, dialogs, cursors, and everything else you can think of. Oh yeah, but while it will read RC files, I couldn't find any way to make it save an RC file! It will, however, do a nice job saving to a binary res file.
Of course, you could just leave it at that and let Visual Studio include the .res file. So I guess you can just use one tool. But I wanted an RC file that I could easily manipulate -- at least for strings and IDs.
That's when I downloaded
Resource Hacker. This tool is made to load resources from just about anywhere. You can do certain things with those resources (although you can't actually edit them). However, this tool will save a proper RC file.
So the steps are:
1. Use XN Resource Editor to create your resources
2. Save resources as a .RES file
3. Open the .RES file with Resource Hacker
4. Save as a .RC file
5. Add the RC file to your Visual Studio project.
You may have to touch up your RC file a little if you get any errors (for example, include winuser.h).
XN can read an RC file, so you can "round trip" by reading the file from step 4 into XN, making changes, and then repeating steps 2 through 4.
Enjoy!
Labels: programming, windows
Submit to:
Del.icio.us |
Digg |
Slashdot |
Diigo
Alternative to Spy++
I used to use the full blown Microsoft developers tools, but lately I've been using the express versions along with some open source development tools. In general, I don't miss much about the Microsoft compiler. But I have to admit that I miss some of the tools.
A few weeks ago, I started getting a mysterious error message on my computer. It was a dialog box complaining about the flash installation. There was no hint of which program was complaining though. I thought about running Spy++ -- the Microsoft utility for looking at on screen Windows -- and realized this computer doesn't have a full load of Visual C++!
What I did find is
Winspector. This is like a souped up version of Spy++ and its free. Winspector can show hidden windows or not. It can filter and buffer messages. It can watch messages to a window class from the Window's creation. In short, it does everything Spy++ does plus more.
So, what was the offending program?
System47, my Star Trek screen saver. Reinstalling it did the trick. I guess a recent flash upgrade broke it. Should have realized my screen saver wasn't running. If you are a Star Trek fan (or even a science fiction fan) you really ought to download this free screen saver. It is quite the conversation piece.
Labels: cool, programming, software, windows
Submit to:
Del.icio.us |
Digg |
Slashdot |
Diigo
Virtualization
I've long been a fan of using virtualization to run Linux under Windows or Windows under Linux. I've even used virtualization to host Windows under Windows or Linux under Linux so I can change things around with impunity or test something with an "old" operating system. I've used VirtualPC, VMWare, and Parallels. InnoTek recently made their virtualization product open source. From their Web site:
Presently, VirtualBox runs on Windows and Linux 32-bit hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), and OpenBSD.
Here's the link:
Labels: linux, software, Tips, windows
Submit to:
Del.icio.us |
Digg |
Slashdot |
Diigo
Windows Gets the Emacs Religion
You know, for some of us Emacs isn't a program -- its the guiding force in life (well, maybe I'm going a little overboard... then again,
maybe not).
The problem with getting those Emacs commands ingrained in your head (or your fingers) is that you then have to use other programs! It is very painful to use Word or an IDE without those Emacs keystrokes.
I'm writing this on a Windows box using Firefox in a Blogger HTML editor. But guess what? Control+A takes me to the start of the line, Control+W cuts, and Control+Y pastes! Why? I'm running xkeymacs, a nice free program that lets you map Emacs keystrokes for Windows applications.
It does take a little work to get everything just right. For example, I added ^X-0 (zero) to send Firefox a Control+W which closes the current tab. ^X-2 can create a new tab. It is a little tricky to add new things (but not too bad, you just have to edit a text file with a lisp-like syntax). You also need to set it up so each program has its own settings (which means you can disable it for certain programs, or change Control+W to send escape (for Thunderbird, for example).
You can find xkeymacs here:
http://www.cam.hi-ho.ne.jp/oishi/indexen.html If you prefer just "fixing" Office applications, you might try:
http://www.rath.ca/Misc/VBacs/Oh, and if you don't think Emacs is powerful enough, here's some food for thought:
http://www.informatimago.com/linux/emacs-on-user-mode-linux.htmlLabels: emacs, software, windows
Submit to:
Del.icio.us |
Digg |
Slashdot |
Diigo
Free Software -- Plenty of It
I was reading a post on another ham radio blog about free software. It occurred to me that a lot of people probably aren't aware of the
OpenCD project. This single disk image has favorites like OpenOffice, Firefox, Thunderbird, and the GIMP. But it also has programs like Audacity, NVU, and plenty more. On top of that, the CD acts as a live Linux disc, so you can boot Linux or install your favorites on Windows, depending on your mood.
Good stuff!
Labels: linux, software, windows
Submit to:
Del.icio.us |
Digg |
Slashdot |
Diigo
Six Free Software Titles
Over the years I've written a lot of software and I've given away a good bit of it. Here's some of what I have scattered around my Web sites for free download:
Bid Time - Computes eBay end times to local time.
AWC Dial- Dial the phone using the modem and TAPI. Includes a call timer.
ASCIICad - Draw with ASCII text
SCBIND - Compile shell scripts to encoded executables (Unix/Linx/Cygwin) [[I have a new version of this I need to package up and release -- if you are really going to use it, ask me]]
Stamp I emulator - see
http://www.al-williams.com/awce/bs1emu.htmFconvert - Convert between floating point, IEEE, Microchip and PAK formats - see
http://www.al-williams.com/awce/fconvert.zipThe most widely-distributed software I've probably ever written was PSKGNR, the once popular PSK31 add on program for Ham radio operators. However, PSKGNR is a relic now, replaced by all-in-one programs. But it was fun while it lasted!
Labels: linux, software, windows
Submit to:
Del.icio.us |
Digg |
Slashdot |
Diigo
Fixing Cygwin & MingW
I'm a long-time
Cygwin user (and a longer-time Unix and Linux user). It is handy to have the whole suite of Linux tools under Windows. Of course, one feature every Linux programmer uses constantly is gcc -- the Gnu C compiler. However, the Cygwin compiler by default creates binaries for use with Cygwin. That means you need a commercial license to distribute them and it also means you can't just send an executable to your buddy who doesn't use Cygwin.
There is a another project that allows gcc to run under Windows called MingW. In fact, you can use the Cygwin tools to install the MingW libraries and -- in theory -- a simple -mno-cygwin command line option will let you compile Ming binaries (that is, normal Windows executables that don't depend on Cygwin). Of course, you lose any "special" Cygwin features when you do this, but that's the price.
I've used this before, but unfortunately it seems to be broken in the current release of Cygwin. Here's what I did to fix it.
1) In /usr/lib/gcc there is a directory for i686-pc-mingw32/3.4.4. In that directory, the Cygwin installer put ordinary .lnk files linking back to /usr/lib/gcc/i686-pc-cygwin/3.4.4. None of these work, so the first step is to make hard or symbolic links to the correct files. For example, cc1.exe.lnk needs to be fixed (from the i686-pc-mingw32/3.4.4 directory):
ln ../i686-pc-cygwin/cc1.exe cc1.exe
Fix all the links in this way. Now gcc will run with -mno-cygwin, but it still won't link.
2) The problem is, gcc is a driver and the specs file is broken. In the same directory, edit the file named specs. The trick here is we need to change the references to crt2.o to refer to a specific path (/usr/lib/mingw/crt2.0). We also need to add -L/usr/lib/mingw to several places. Here's a diff between the standard specs file and mine (significant additions in red):
$ diff specs ../../i686-pc-cygwin/3.4.4/specs
51c51
< %{pg:-lgmon} %{!mno-cygwin:-lcygwin} %{mno-cygwin:%{mthreads:-lmingwthrd -L/usr/lib/mingw} -lmingw32} %{mwindows:-lgdi32 -lcomdlg32} -luser32 -lkernel32 -ladvapi32 -lshell32
---
> %{pg:-lgmon} %{!mno-cygwin:-lcygwin} %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} %{mwindows:-lgdi32 -lcomdlg32} -luser32 -lkernel32 -ladvapi32 -lshell32
54c54
< %{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt -L/usr/lib/mingw}
---
> %{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}
57c57
< %{shared|mdll: %{mno-cygwin:dllcrt2%O%s}} %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:/usr/lib/mingw/crt2%O%s} %{mno-cygwin:-L/usr/lib/mingw} %{pg:gcrt0%O%s}}}
---
> %{shared|mdll: %{mno-cygwin:dllcrt2%O%s}} %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:crt2%O%s} %{pg:gcrt0%O%s}}}
Now you are done. Want to prove it? Try making a file howdy.c:
#include
void main() {
printf("Howdy!\n)";
}
Now compile it without using cygwin:
gcc -o howdy.exe -mno-cygwin howdy.c
Sure it works, but how do you know it isn't using Cygwin? Try this:
objdump -p howdy.exe | grep dll
You'll see:
$ objdump -p howdy.exe | grep dll
DLL Name: msvcrt.dll
DLL Name: KERNEL32.dll
If you recompile without the -mno-cygwin option and rerun objdump, you'll see the executable now relies on cygwin1.dll!
Notice that if you want to build DLLs you probably have to fix the dllcrt2.o in the spec file the same way. But from here you should be able to figure it out!Labels: cygwin, linux, Tips, windows
Submit to:
Del.icio.us |
Digg |
Slashdot |
Diigo