ProgrammerDude¿
Sep 26th, 2001, 09:06 AM
Is there a way that I can make an app only allow focus on itself and nothing else until it is unloaded? I am making a test program and I don't want the users to be able to store answers in a text file on the hard drive or something and then look at them while writing.
Thanks for help
jim mcnamara
Sep 26th, 2001, 10:05 AM
This keeps your window from losing focus to another window that is already activated but doesn't have focus.
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Sub FormOnTop()
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE _
Or SWP_NOSIZE
End Sub