سؤال

I want to know how to make a screen locker using VB6. I have tried maximizing the frame but it still can be minimized. Then I have made the frame very large to fit the entire screen and made the frame irresizeable but someone can press Alt+F4 and close it. I also want the task manager to be disabled. So can anyone please help me?

هل كانت مفيدة؟

المحلول

You can remove the exit button and make the form immovable and irresizeable. The you can call a batch file that will stop the task manager as :

:run
taskkill /f /im taskmgr.exe
goto run

This will continuously stop the task manager if it is opened.

نصائح أخرى

This is probably not what you are trying to do but, you can lock windows by calling the WINAPI function LockWorkStation.

Option Explicit
Private Declare Function LockWorkStation Lib "User32" () As Boolean

Call it with

Call LockWorkStation

If you put the declare statement in a .bas module and call it from a form you will want to change the declare scope to Public. This function is supported in Windows XP and up, and Windows Server 2003 and up.

There is no absolute way to completely prevent the application from stopping. And can we know why you would do that?

Still, you can prevent the user from closing the application with the cancel parameter.

private sub Form_unload(Cancel as Integer)
    Cancel = 1
End Sub
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top