Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
_Screen.Activeform.Name NOT accurate
Message
From
07/06/2007 07:16:48
Walter Meester
HoogkarspelNetherlands
 
 
To
06/06/2007 08:13:44
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01230724
Message ID:
01231189
Views:
32
Hi Doug,

Basically it is more or less implemeted like below.
In our case on a desktop form:
FUNCTION init()

declare integer GetWindowLong in Win32API integer hWnd, integer nIndex
declare integer CallWindowProc in Win32API ;
	integer lpPrevWndFunc, integer hWnd, integer Msg, integer wParam, integer lParam

* Get a handle for the VFP Windows event handler.
This.nOldProc = GetWindowLong(_screen.hWnd, GWL_WNDPROC)

* Bind to the Windows events we're interested in.
bindevent(_vfp.hWnd, WM_ACTIVATE,      This, 'HandleEvents')
RETURN

*-

FUNCTION HandleEvents
LPARAMETERS HWND, Msg, wParam, tlParam
LOCAL lcCaption, lnParm, lcPath

IF Msg = WM_ACTIVATE
	DO CASE
		CASE wParam = WA_INACTIVE
			* Handle a deactivate event.
			THIS.lastwontop=WONTOP()
			* Handle an activate event (task switch or clicking on the title bar, clicking in the client area of the window).

		CASE INLIST(wParam,  WA_ACTIVE, WA_CLICKACTIVE)
			IF NOT EMPTY(THIS.lastwontop)
				ACTIVATE WINDOW (THIS.lastwontop)
			ENDIF
			this.lastwontop=""
	ENDCASE
ENDIF
*-- this plays the role of dodefault():
RETURN THIS.HandleWindowsMessage(HWND, Msg, wParam, tlParam)

*-

FUNCTION HandleWindowsMessage
LPARAMETERS hWnd, nMsg, wParam, lParam
LOCAL nResult

nResult = CallWindowProc(This.nOldProc, hWnd, nMsg, wParam, lParam)
RETURN nResult
>Hi Walter.
>
>>For the last couple of months we had significant trouble with activeX controls on modal forms causing VFP to be confused about the activeForm. The result was that a modeless form behind the modal form became active and the application locked up. We finally has a solution that involved using WONTOP() and some bindevents() and avoided the problem.
>
>Could you be more specific about your solution? Thanks.
>
>Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform