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
Printable View
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
I believe you can.. use..
Code:frmFormName.Show vbModal
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!!!
Sorry, vbmodal on show is only for app modal..
You can use a msgbox..
like so:
Code:MsgBox "Prompt", vbOkOnly + vbSystemModal, "Title"
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?
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.
[Edited by Vlatko on 10-20-2000 at 08:12 AM]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
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