Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
App to apply exams
Message
From
01/12/2010 17:13:58
 
 
To
01/12/2010 16:59:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01482141
Message ID:
01491475
Views:
58
That scenario. :o)

I got it. Thanks!
>>any idea where you would put the force focus back to your app at?
>
>Depends on what you want to do. If you want your app to never lose focus, then in the case wParam = WA_INACTIVE... then everyone will hate you because they can't leave your app.
>
>What scenario do you have in mind?
>
>>>>Hi!
>>>>How can I do to restrict user access to another apps or SO while running my app?
>>>>I need to do this because my app is used to apply exams.
>>>
>>>I don't know of such a thing, but there are other things you can do - using bindevent() to system messages to your app's window. You can trap the moment your app loses focus, and then decide what to do - log the event, force focus back to your app, etc.
>>>
>>>I had done some of this once - here's an attempt to prevent the content of the clipboard leaving the app:
>>>
>>>
***
>>>***	dcappfocus.prg
>>>***
>>>
>>>* 	2006/09/16 10:11:05
>>>* 	Visual FoxPro 09.00.0000.3504 for Windows
>>>
>>>*** based on Doug Hennig's article
>>>*** ----------------------------------
>>>***
>>>
>>>#include include\WinEvents.H
>>>
>>>
>>>DEFINE CLASS frmwinevents AS form
>>>	Height = 214
>>>	Width = 494
>>>	ShowWindow = 2
>>>	Caption = "Windows Events Test"
>>>	stevka=""
>>>	noldproc = 0
>>>	nshnotify = 0
>>>	Name = "frmWinEvents"
>>>
>>>	PROCEDURE Init
>>>		* Declare the Windows API functions we'll use.
>>>		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')
>>>
>>>	ENDPROC
>>>
>>>*******************************
>>>	PROCEDURE Destroy
>>>		* Unregister us from receiving shell events, unbind all events from our
>>>		* window and _vfp, and redisplay VFP.
>>>
>>>		with This
>>>			unbindevents(_vfp.hWnd)
>>>		endwith
>>>	ENDPROC
>>>
>>>*******************************
>>>	PROCEDURE HandleWindowsMessage
>>>		lparameters hWnd, ;
>>>			Msg, ;
>>>			wParam, ;
>>>			lParam
>>>		local lnResult
>>>		lnResult = CallWindowProc(This.nOldProc, hWnd, Msg, wParam, lParam)
>>>		return lnResult
>>>	ENDPROC
>>>
>>>
>>>*******************************
>>>	PROCEDURE HandleEvents
>>>		lparameters hWnd, ;
>>>			Msg, ;
>>>			wParam, ;
>>>			lParam
>>>		local lcCaption, ;
>>>			lnParm, ;
>>>			lcPath
>>>		do case
>>>				
>>>		* Handle an activate or deactivate event.
>>>			case Msg = WM_ACTIVATE
>>>				do case
>>>
>>>		* Handle a deactivate event.
>>>					case wParam = WA_INACTIVE
>>>						this.stevka=_cliptext
>>>						_cliptext=""
>>>
>>>		* Handle an activate event (task switch or clicking on the title bar).
>>>					case wParam = WA_ACTIVE
>>>						IF !EMPTY(_cliptext)
>>>						ELSE
>>>							_cliptext=this.stevka
>>>						endif
>>>		* Handle an activate event (clicking in the client area of the window).
>>>					case wParam = WA_CLICKACTIVE
>>>						IF !EMPTY(_cliptext)
>>>						ELSE
>>>							_cliptext=this.stevka
>>>						endif
>>>				endcase
>>>		ENDCASE
>>>		*-- this plays the role of dodefault():
>>>		return This.HandleWindowsMessage(hWnd, Msg, wParam, lParam)
>>>	ENDPROC
>>>
>>>ENDDEFINE
>>>*
>>>
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform