>>>#define SW_SHOWMINIMIZED 2 >>>#define SW_SHOWMAXIMIZED 3 >>>#define SW_MAXIMIZE 3 >>>#define SW_SHOWNOACTIVATE 4 >>>#define SW_SHOW 5 >>>#define SW_MINIMIZE 6 >>>#define SW_SHOWMINNOACTIVE 7 >>>#define SW_SHOWNA 8 >>>#define SW_RESTORE 9 >>>#define SW_SHOWDEFAULT 10 >>>#define SW_FORCEMINIMIZE 11 >>> >>>DECLARE short ShowWindow IN WIN32API ; >>> integer hWnd, ; >>> integer nCmdShow >>>declare short SetForegroundWindow in win32API integer nHwnd >>>DECLARE short GetWindowPlacement IN WIN32API ; >>> integer hWnd, ; >>> string @ lpwndpl >>> >>>lpwndpl = CHR(4*3+8*2+4*4)+replicate(CHR(0),4*3+8*2+4*4-1) >>> >>> lnHWND = _screen.Hwnd >>> SetForegroundWindow( m.lnHWND ) >>> IF ( GetWindowPlacement(m.lnHWND, @lpwndpl) # 0 ) AND ; >>> INLIST(ASC(SUBSTR(m.lpwndpl, 4+4+1, 1)), ; >>> SW_SHOWMINIMIZED, SW_MINIMIZE, SW_SHOWMINNOACTIVE, SW_FORCEMINIMIZE) >>> ShowWindow(lnHWND, SW_RESTORE) >>> endif >>>>>
DECLARE integer GetForegroundWindow IN win32API Declare integer GetCurrentThreadId in win32API declare integer GetWindowThreadProcessId in win32API ; integer hWnd, integer @lpdwProcessId DECLARE short SetForegroundWindow IN win32API integer lnHWnd Declare short AttachThreadInput in win32API ; integer idAttach, integer idAttachTo, short fAttach oTmr = CreateObject('myTimer', GetForegroundWindow()) ? 'Started countdown' Read events Define Class myTimer as Timer nHWND = 0 Interval = 10000 Procedure Init Lparameters tnHWND this.nHWND = tnHWND endproc Procedure Timer This.Enabled = .f. this.GetFocusBack() Clear events endproc Procedure GetFocusBack lpdwProcessId = 0 lnThreadID1 = GetCurrentThreadId() lnThreadID2 = GetWindowThreadProcessId(this.nHWND, @lpdwProcessId) AttachThreadInput(lnThreadID1, lnThreadID2, 1) SetForegroundWindow(this.nHWND) AttachThreadInput(lnThreadID1, lnThreadID2, 0) endproc enddefineCetin