Monday, December 21, 2009

Hacking the TTouchKeyboard Part I

Hacking the TTouchKeyboard Part I
Hacking the TTouchKeyboard Part II
Hacking the TTouchKeyboard Part III
Hacking the TTouchKeyboard Part IV
Hacking the TTouchKeyboard Part V (not published yet)

The TTouchKeyboard is a a fairly flexible on screen keyboard that supports multiple keyboard layouts but only shipped with the number pad and the standard keyboard layout for a whole lot of input languages. How to create these keyboard layouts has been a mystery, until now. Over the next few posts I'll provide some tools, documentation and sample code to build everything you need to hack the TTouchKeyboard.

The first bit of code I'm going to provide demonstrates listing all the keyboard layouts that are available. It's pretty simple really. A keyboard layout is just a resource with the string "KEYBOARD" in the name.

procedure GetKeyboardLayoutNames(ANames: TStrings);

function EnumResNames(Module: HMODULE; ResType, ResName: PChar;
Nothing: Pointer): Integer; stdcall;
const
sResourceName = 'KEYBOARD';
begin
if Pos(sResourceName, ResName) > 0 then
LayoutNames.Add(ResName);
Result := 1;
end;

begin
LayoutNames := TStringList.Create;
try
EnumResourceNames(HInstance, RT_RCDATA, @EnumResNames, 0);
ANames.Clear;
ANames.AddStrings(LayoutNames);
finally
FreeAndNil(LayoutNames);
end;
end;


Once you have a layout you can load it by calling this little function.

function LoadLayout(const LayoutName: string): TVirtualKeyLayout;
var
Stream: TResourceStream;
TempStream: TStream;
begin
Result := nil;
Stream := TResourceStream.Create(HInstance, LayoutName, RT_RCDATA);
try
Result := TVirtualKeyLayout.Create;
Result.LoadFromStream(Stream);
finally
Stream.Free;
end;
end;


Next I'll show how to iterate the data structures and save it to an XML file for easy text manipulation.

Wednesday, December 16, 2009

Book Review: Physics of Superheros



With Christmas right around the corner I thought I'd share with everyone one of my favorite stocking stuffers, The Physics of Superheros. Now I haven't read the entire book and have only thumbed through the second edition at the local bookstore, but what I have read is awesome.

The author, James Kakalios, is a college physics professor who teaches his physics courses by using examples comic books. How awesome is that! If only this was my text book in High School and College physics. Anyway, it is a worthy read in my opinion and anyone who reads this blog would probably enjoy this book.





Please read my full disclosure of any biases I may have.

Thursday, December 3, 2009

Hang With Cool People

The other day I read that depression is contagious and thought to my self "duh!" Just as you are what you eat you are who you hang out with. Eat too many carrots and you turn orange (seriously, my daughter did this). Hang out with the people you want to be like and you'll be just like them. Who say's you can't learn by osmosis.

Wednesday, December 2, 2009

Glacier National Park

Last summer Glacier Park Magazine editor Chris Peterson engaged in a project to photograph Montana's Glacier National Park over 100 consecutive days. He used a mix of film and digital cameras that would have been used over the course of the Park's 100 years.

Check out the blog here with a post from each day. The photos are awesome.

My personal favorite is Day 62 because I know exactly how Chris feels about that tree. I have many trees and rocks in various parks that I could spend hours at.

Tuesday, December 1, 2009

Full Disclosure

On October 5 2009 the Federal Trade Commission in the United States published an 81 page guideline requiring that all product endorsements and testimonials on web sites, blogs, Facebook, Twitter, and other social media disclose "...their connection, if any, with the advertisers; and also reveal the receipt of free products and or payments from the advertisers" effective today, December 1 2009.

This page will be updated to make clear my commercial relationships going forward and will be permanently linked on the site's side panel, found on the right side of this blog.

I am employed by Embarcadero Technologies Oracle.

I have Amazon, Google and B&H Photo advertisements on this blog and I earn a percentage of the sale if you click on the link and buy the item. I don't do it for the money, I do it to provide the readers of this blog links to products that I think are exceptional. I would not provide a link to the product if I didn't think it was exceptional and I didn't already use it. I really don't earn much but it's something and it is fun to get a check once in a while.

I have had a working relationship with Apple since the release of Aperture. I have done contract photography for them, they have provided me with long term use of software and hardware (although more software than hardware) and paid me money (although I think I have given them more money over the years than they have given me). I have also owned stock in Apple for years. None of this influences what I write here about their products.

I own stock in various companies but mostly are in mutual funds so chances are if there is a stock some fund manager has purchased a small percentage of it with a few of my dollars and I guarantee none of that influences stuff that I write.