|
-
Jun 20th, 2009, 06:55 PM
#1
Re: lock windows
Form1.Show vbModal
When used on one of your forms no other of your forms can be accessed until the vbModal form is closed. Again, why do you care about any other programs?
-
Jun 21st, 2009, 04:14 PM
#2
Thread Starter
Lively Member
Re: lock windows
o.k.
thanx
i have seen that you can confine the mouse tho the form...
my ? is can i stop the mouse from leaving the fiscal edge of the form i.e. if it arrives at the edge, it stops!
tahnx in advance
MrSmither
he is a good friend that speaks well of us behind our backs
-
Jun 21st, 2009, 05:18 PM
#3
Re: lock windows
Here's an example from the API Guide that uses the ClipCursor API do do that.
Code:
Private Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type
Private Type POINT
x As Long
y As Long
End Type
Private Declare Sub ClipCursor Lib "user32" (lpRect As Any)
Private Declare Sub GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT)
Private Declare Sub ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINT)
Private Declare Sub OffsetRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long)
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Command1.Caption = "Limit Cursor Movement"
Command2.Caption = "Release Limit"
End Sub
Private Sub Command1_Click()
'Limits the Cursor movement to within the form.
Dim client As RECT
Dim upperleft As POINT
'Get information about our wndow
GetClientRect Me.hWnd, client
upperleft.x = client.left
upperleft.y = client.top
'Convert window coördinates to screen coördinates
ClientToScreen Me.hWnd, upperleft
'move our rectangle
OffsetRect client, upperleft.x, upperleft.y
'limit the cursor movement
ClipCursor client
End Sub
Private Sub Command2_Click()
'Releases the cursor limits
ClipCursor ByVal 0&
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Releases the cursor limits
ClipCursor ByVal 0&
End Sub
-
Jun 22nd, 2009, 01:21 AM
#4
Re: lock windows
 Originally Posted by mr smither
o.k.
thanx
i have seen that you can confine the mouse tho the form...
my ? is can i stop the mouse from leaving the fiscal edge of the form i.e. if it arrives at the edge, it stops!
tahnx in advance
MrSmither
If you are trying to prevent users from using the mouse to access any other windows, then that could do it. But they will still be able to use the keyboard to maneuver around, including Ctrl+Alt+Del to access task manager and shut your app down so they can get their mouse back -- that's what I'd do.
-
Jun 22nd, 2009, 03:16 AM
#5
Re: lock windows
 Originally Posted by LaVolpe
If you are trying to prevent users from using the mouse to access any other windows, then that could do it. But they will still be able to use the keyboard to maneuver around, including Ctrl+Alt+Del to access task manager and shut your app down so they can get their mouse back -- that's what I'd do.
that's also stoppable with a keyboard hook. There's code samples on the forum. But (especially if you are using a twain device) if for some reason it locks your program up, the user will have to reset the computer.
Why you would want your program to access their scanner is beyond me, unless it's a scanning program. In that case, you'd be better off with a progress bar. (i am assuming here. you said scaner, and who knows what you really meant)
-
Jun 22nd, 2009, 03:06 PM
#6
Re: lock windows
 Originally Posted by Lord Orwell
Why you would want your program to access their scanner is beyond me, unless it's a scanning program. In that case, you'd be better off with a progress bar. (i am assuming here. you said scaner, and who knows what you really meant)
I would also ask the question, why would you want to prevent the user from accessing their computer while this app is accessing the scanner? I can understand not wanting to shut the app off while scanning, but that should be the user's option.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|