I have created a modeless dialog box which is "in focus" when my application starts. I need to detect the F1 key, but it is not tied to any menu selection or dialog control. I have tried OnKeyDown, but that function does not seem to get called when I press the F1 key (or any other key). Is there a trick to OnKeyDown? How do you detect key presses when dialog boxes are displayed?