This code changes a parent window for the given form to the Windows Desktop.
PUBLIC objForm
objForm = CreateObject("Tform")
objForm.Visible = .T.
DEFINE CLASS Tform As Form
AutoCenter=.T.
PROTECTED formstatus
PROCEDURE Init
THIS.formstatus = 0
PROCEDURE Activate
IF THIS.formstatus = 1
RETURN
ENDIF
DECLARE INTEGER GetDesktopWindow IN user32
DECLARE INTEGER GetFocus IN user32
DECLARE INTEGER SetParent IN user32;
INTEGER hWndChild, INTEGER hWndNewParent
LOCAL hForm, hDesktop
hDesktop = GetDesktopWindow()
hForm = GetFocus()
* if successfully changing the parent window for this form
* then minimizing the main VFP window
IF SetParent (hForm, hDesktop) <> 0
THIS.formstatus = 1
_SCREEN.WindowState = 1
ENDIF
ENDDEFINE
GetDesktopWindow
GetFocus
SetParent
It makes the form less dependent on the main VFP window. Its icon even appears on the Windows toolbar.
As I can see some more adjustments should be done to the form through the SetWindowLong function, since it is not possible to put it on top when it is hidden by other windows.