|
-
Sep 27th, 2000, 07:41 AM
#1
Thread Starter
Junior Member
I want that my form should not be closed by either clicking any control buttons on the form, as well as not be closed by by clicking End task in the task manager list of programs.
Is there something called Hook function?
-
Sep 27th, 2000, 07:57 AM
#2
Frenzied Member
You can do this by using DeleteMenu to remove the Close item from the system menu.
It doesn't work for End Task, but then again Windows is the OS, so it can decide what to close, if you know what I mean. I don't think there's a way to mark a program as unclosable from End Task, but heck, I've been wrong before.
-
Sep 27th, 2000, 07:58 AM
#3
_______
<?>
Code:
'Step 1
'disable the close button of a form
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
if unloadmode = vbFormControlMenu then
cancel = true 'because you still want to be able to close via code
end if
End Sub
'Step 2
'disable the alt/ctrl/delete functions
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
Sub DisableCtrlAltDelete(bDisabled As Boolean)
Dim X As Long
X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
Private Sub Command1_Click()
Call DisableCtrlAltDelete(True)
End Sub
Private Sub Command2_Click()
Call DisableCtrlAltDelete(False)
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 27th, 2000, 08:01 AM
#4
Fanatic Member
As far as I am aware you cannot stop the program appearing in the list of processes in task manager, but you can disable the close buttons, and the close option, see the post I made earlier:
http://forums.vb-world.net/showthrea...threadid=32654
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Sep 27th, 2000, 08:05 AM
#5
_______
<?>
crispin: 
If you disable the alt/ctrl/delete you can't see the task manager so it's no matter what is in it.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 27th, 2000, 08:18 AM
#6
Fanatic Member
can you not right-click on the clock and get it without using ctrl-alt-del?
In NT you can anyway.
[Edited by crispin on 09-27-2000 at 09:26 AM]
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Sep 27th, 2000, 09:03 AM
#7
Frenzied Member
In your form_QueryUnload routine, you can test for the source of the close. Then you can decide if you want to cancel the close.
See QueryUnload Event
or QueryUnload Event Example
for more info.
-
Sep 27th, 2000, 09:07 AM
#8
_______
<?>
can you not right-click on the clock and get it without using ctrl-alt-del?
In NT you can anyway.
Yes, but I am assuming that if you have a program you don't want closed you are not going to show the icon anywhere. The only way to get at it will be your version of options not the users.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 27th, 2000, 09:21 AM
#9
Fanatic Member
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Sep 27th, 2000, 09:33 AM
#10
Lively Member
Just hide your app in the close program box. when the user hits alt ctrl del your program will now show...... Go to http://www.planet-source-code.com and do a search on "alt ctrl del" and you should get a list of solutions back
-
Sep 27th, 2000, 09:40 AM
#11
If you don't want your program to appear in the proccess list, do this:
Code:
App.TaskVisible = False
-
Sep 27th, 2000, 11:36 AM
#12
That only works for Windows NT
-
Sep 27th, 2000, 11:38 AM
#13
This will work for Windows 95/85/ME
Code:
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Private Sub Form_Load()
'Hide from Task List
RegisterServiceProcess GetCurrentProcessId, 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Show in Task list
RegisterServiceProcess GetCurrentProcessId, 0
End Sub
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
|