And how?
I want to implement an simple enough dialog with several buttons.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One of the easiest ways to get some simple dialogs and a bit of associated code running in Windows is AutoHotKey. It’s free-as-in-beer, too.
It’s a macro script environment where you can write little programs as scripts (and hook them to keys, that’s where it got its name and original purpose).
AHK is a BASIC-like tiny scripting language that’s all about simplicity and ease of use. Good enough for most small projects you’d care to do.
One use case/experience
I’m not a Windows programmer at all; I used to program in Delphi a bit, but now I’m mostly working in Java. Recently my girlfriend needed a bit of hacking: She bought a product with a registration key, and part of that key was smudged off the sticker. What we needed was a program to brute-force try all the possible missing letters/numbers in the program’s registration dialog. Legitimate hacking, if you will.
I considered doing this in Delphi, then I started thinking about which arcane system calls I’d be needing to reach into the GUI of another program and to poke text into the input dialog… it turned out to be very easy in AHK. I needed about 10 minutes to write my hacking program, and it took about 5 minutes to find the right key.
If I remember correctly, my little program even included a dialog for specifying what we knew of the key, and which places had to be trial-and-errored. And of course a “start” button.
Update with example
I really wish I still had that little script I wrote as described above, but it’s been several years and I’ve thrown it away.
I dug up this little gem on the net:
I agree that this is a silly and useless program; I found it quite hard to find useful small examples on the ‘net. Most of the people who write AHK scripts seem to enjoy hanging bells and whistles off their creations until they end up being full-fledged applications and no longer suitable as small examples.
A lot of useful snippets of code, though, can be found in AHK’s Tutorial and overview:
http://www.autohotkey.com/docs/Tutorial.htm
Much of what they talk about is hanging certain capabilities off certain keys. This is how AHK started, but meanwhile it’s a (mostly) full-fledged Windows programming language. So don’t pay too much attention to the key mapping stuff.
Here’s a cute little script to run Notepad and then issue a message box:
Here’s a small dialog to get some input from a user: