|
-
Oct 20th, 2000, 06:09 AM
#1
Hallo
How can I make a form system modal. In other words, nothing else can be opened on the computer will this one form is not filled in?
Would appreciate any help....maybe another way of doing it
Thanx
-
Oct 20th, 2000, 06:24 AM
#2
Lively Member
I believe you can.. use..
Code:
frmFormName.Show vbModal
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Oct 20th, 2000, 06:29 AM
#3
Hallo
I tried vbModal, but you can still move between other programs and your application. I want to freeze the whole computer until my form is executed correctly.
I also tried vbSystemModal, but receive an error (Invalid procedure call....)
Can anyone help!!!
-
Oct 20th, 2000, 06:37 AM
#4
Lively Member
Sorry, vbmodal on show is only for app modal..
You can use a msgbox..
like so:
Code:
MsgBox "Prompt", vbOkOnly + vbSystemModal, "Title"
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Oct 20th, 2000, 06:45 AM
#5
Hi
Form is a login form. The user must complete this form before going on. On accessing the computer, I'm writing a log file....so I cannot use a msgbox. Isn't there something like Lib "user32" that I can use?
-
Oct 20th, 2000, 07:08 AM
#6
Frenzied Member
Try This :
The user will not be able to move the mouse or to use ctrl,alt or delete or do anything.He will only be allowed to do something inside this form.
Code:
'in module
Private Declare Function SystemParametersInfo Lib _
"user32" Alias "SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, ByVal lpvParam As Any, _
ByVal fuWinIni As Long) As Long
Declare Function ClipCursor Lib "user32.dll" (lpRect As RECT) As Long
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Declare Function 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) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Sub DisableCtrlAltDelete(bDisabled As Boolean)
Dim x As Long
x = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
'in form
Private Sub Form_Load()
Call DisableCtrlAltDelete(True)
Call SetWindowPos(hwnd, HWND_TOP = 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOACTIVATE Or SWP_NOSIZE)
Dim r As RECT
GetWindowRect Form1.hwnd, r
Call ClipCursor(r)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim deskh As Long
Dim deskr As RECT
deskh = GetDesktopWindow
GetWindowRect deskh, deskr
ClipCursor deskr
Call DisableCtrlAltDelete(False)
End Sub
'Use something to unload the form
'Private Sub Form_DblClick()
'Unload Form1
'End Sub
[Edited by Vlatko on 10-20-2000 at 08:12 AM]
-
Nov 7th, 2000, 03:39 AM
#7
Hallo
Thanx for the code. I'm experiencing one problem....If i run this code from VB it works perfectly, but as soon as I'm running the exe, the mouse is not kept within the window parameters. Is there something that I missed?
Thanx
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
|