Article ID:qGEN014
Date Revised:January 09, 1999
Keywords:Help, HTMLHelp, Win32API, OnTop, FindWindow, SetWindowPos

Question: How can we get the new HTMLHelp window to stay on top of all other windows like we could do with the old .HLP window?

Answer: HTMLHelp doesn't have an Always On Top view option. It's pretty easy though to use Win32API calls to alter the help window state from inside VFP. Here's the code it takes:

* HelpOnTop.prg 05-Jan-99

* Set the VFP6 help window to always ontop

* Usage: HelpOnTop( lOnTop )
* lOnTop - .t. set it to top
*          .f. set it to not on top

lparameter plOnTop

if ( ( type( "plOnTop" ) != "L" ) or ( pcount() = 0 ) )
   plOnTop = .t.
endif

local lnHwnd

#DEFINE HWND_TOPMOST -1
#DEFINE HWND_NOTOPMOST -2
#DEFINE SWP_NOSIZE 1
#DEFINE SWP_NOMOVE 2

declare integer FindWindow in win32api ;
  string lpClassName, ; && pointer to class name
  string lpWindowName   && pointer to window name

declare integer SetWindowPos IN win32api ;
  integer hWnd,            ; && handle to window
  integer hWndInsertAfter, ; && placement-order handle
  integer X,               ; && horizontal position
  integer Y,               ; && vertical position
  integer cx,        ; && width
  integer cy,              ; && height
  integer uFlags             && window-positioning flags

lnHwnd = FindWindow( .null., "Visual FoxPro 6.0" )

if ( lnHwnd > 0 )
   SetWindowPos( lnHwnd, iif( plOnTop, HWND_TOPMOST, HWND_NOTOPMOST ), 0,0,0,0, SWP_NOSIZE + SWP_NOMOVE )
endif


1