DECLARE Long FindWindow In Win32API String, String LOCAL lnHWND lnHWND = FindWindow(Null,thisform.caption) If lnHWND >0 =ForceForegroundWindow(lnHWND) ENDIFHere is the code in a method of the form that is called to make the form MINIMIZED to the Taskbar.
DECLARE Long FindWindow In Win32API String, String LOCAL lnHWND lnHWND = FindWindow(Null,thisform.caption) If lnHWND >0 =BringWindowToBottom(lnHWND) ENDIFHere is the code that makes it NORMAL and to the front
FUNCTION ForceForegroundWindow(lnHWND) LOCAL nForeThread, nAppThread =decl() nForeThread = GetWindowThreadProcessId(GetForegroundWindow(), 0) nAppThread = GetCurrentThreadId() IF nForeThread != nAppThread AttachThreadInput(nForeThread, nAppThread, .T.) BringWindowToTop(lnHWND) ShowWindow(lnHWND,9) AttachThreadInput(nForeThread, nAppThread, .F.) ELSE BringWindowToTop(lnHWND) ShowWindow(lnHWND,9) && The 9 forces the window to restore (SW_RESTORE) ENDIF ENDFUNCHere is the code that makes it MINIMIZED to the Taskbar.
FUNCTION BringWindowToBottom(lnHWND) LOCAL nForeThread, nAppThread =decl() nForeThread = GetWindowThreadProcessId(GetForegroundWindow(), 0) nAppThread = GetCurrentThreadId() IF nForeThread != nAppThread AttachThreadInput(nForeThread, nAppThread, .T.) BringWindowToTop(lnHWND) ShowWindow(lnHWND,6) AttachThreadInput(nForeThread, nAppThread, .F.) ELSE BringWindowToTop(lnHWND) ShowWindow(lnHWND,6) && The 6 forces the window to minimize (SW_MINIMIZE) ENDIF ENDFUNC <PRE> and the Declarations... <PRE> FUNCTION Decl *!* DECLARE INTEGER SetForegroundWindow IN user32 INTEGER hwnd DECLARE Long BringWindowToTop In Win32API Long DECLARE Long ShowWindow In Win32API Long, Long DECLARE INTEGER GetCurrentThreadId; IN kernel32 DECLARE INTEGER GetWindowThreadProcessId IN user32; INTEGER hWnd,; INTEGER @ lpdwProcId DECLARE INTEGER GetCurrentThreadId; IN kernel32 DECLARE INTEGER AttachThreadInput IN user32 ; INTEGER idAttach, ; INTEGER idAttachTo, ; INTEGER fAttach DECLARE INTEGER GetForegroundWindow IN user32 ENDFUNC