hello everybody !!!!!!!!!!

I have a code which i coded but in that their is an error

to lock the screen

in the form1 i have written

msgbox("we are about to lock your screen!!!")
me.visible=false
lockscreen.visible=true
lockscreen.killprocess.enabled=true

            'the code i had written in the timer is

public sub killprocess(byval processTokill)
dim proc() As process= Process.GetProcess
for I as Integer =0 To porc.GetUpperBound(0)
If proc(I).processname="Explorer" then
proc(I).kill()
endif
next
endsub

still the code is not getting preferred output

were lockscreen is the name of the form1

in the form2 the password should be entered
in the form2 the code is

'in button
if passwordbox.text="topsecret" then
process.start("explorer")
end
else
endif

Recommended Answers

All 2 Replies

You have a typo in the for loop. You mistyped "proc" as "porc".

As far as I know, you can't lock the screen by killing explorer.exe. It can always be started again from task manager (which can be activated from the keyboard). However, you CAN lock the workstation by executing the following command

rundll32 user32.dll,LockWorkStation

The password to unlock it will be the password used at logon.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.