Check out this KB article at msdn.microsoft.com
Q195516 - HOWTO: Make a Form a Topmost Window Using APIs
You need to make use of the Windows API. First, you need to get the handle of the for. Then, using the handle, you make the form the top-most form - thereby getting focus....
< JVP >
>I'm having a small problem in a project which consist of only one form which is set to be top-level. Everything works alright except for the fact when I run the project the form don't get the focus until I click on it. Why is that?
>
>In my project I have a main.prg which is the first thing to run and which has the following code:
>
>
>CLEAR
>CLEAR ALL
>CLOSE ALL
>
>_SCREEN.VISIBLE = .F.
>
>** Make sure that the program is working in the right directory.
>SET DEFAULT TO (JUSTPATH(FULLPATH(SYS(16))))
>
>** Opens any classlibs or procedure files that are needed.
>SET LIBRARY TO focus ADDITIVE
>SET PROCEDURE TO odclutils ADDITIVE
>
>** Start the main form.
>DO FORM myform
>READ EVENTS
>
>
>What shall I do so that my form gets the focus directly when running the project?