Wikipedia search utility

This is another idea I have had for a while. I use Wikipedia nearly every day, and every time I encounter an unknown word or concept, it’s the first place to look for it. So I thought it would be more comfortable if I could just select the text to be searched for, press some handy keyboard shortcut and have the apropriate Wikipedia article opened. So today I created such utility – wsWikiSearch.
(Yeah, I’ve heard there are more functional/professional utilities of this kind, but I decided to have a go at it anyway).

Download

wsWikiSearch.rar (227 KB)
Freeware
Required : Should work on most Windows versions.

Source code (10 KB)
Required : Delphi 7, Jedi VCL, Synapse (can be avoided)

Technical notes

Basically there are two “tricky” problems to solve here – how to obtain the selected text (from some unknow application the user has opened) and how to launch the search. The latter is easy – you just look at the URL that is generated when you press the “Go” button in Wikipedia’s search box (it’s something like http://en.wikipedia.org/wiki/Special:Search?search=Google&go=Go), insert your search terms in the apropriate place and use ShellExecute() to open the page.

The most portable way of getting selected text from some other window seems to be simulating Ctrl+C and reading the results off the clipboard. This is done by a couple of keybd_event() calls (see source for details). That’s better than SendMessage() because you don’t have to find the handle of the window containing the text (that’s not the same as foreground window – more likely one of its children).

Works for me 🙂 Good luck!

Related posts :

3 Responses to “Wikipedia search utility”

  1. Can you provide this program in PHP version?

  2. Smithb928 says:

    Very nice! eebbdcdgdb

Leave a Reply