Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8367909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:16:05+00:00 2026-06-09T13:16:05+00:00

I want to simulate WindowsKey + L (The short cut to lock the console)

  • 0

I want to simulate WindowsKey + L (The short cut to lock the console) in visual basic and bind it to a function. So when this function is called it will lock the console.
Can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:16:06+00:00Added an answer on June 9, 2026 at 1:16 pm

    Simulating the hotkey is the wrong approach. All you need to do is call the LockWorkStation function. This has the same result as pressing Ctrl+Alt+Del and selecting “Lock Workstation”, or using the Win+L hotkey, except that you can do it programmatically through code.

    To call this function from a VB application, you’ll need to write a declaration, like so:

    Private Declare Function LockWorkStation Lib "user32.dll" () As Long
    

    You’ll want to place that declaration at the top of your module file, before any procedures are defined. Then, inside one of the procedures, you can call the function. For example:

    Private Sub LockComputer()
        LockWorkStation
    End Sub
    

    Even better code would check the return value of LockWorkStation for an error code. A return value of 0 indicates an error. The standard way of checking for Win32 errors in VB, Err.LastDllError, will give you more information about what exactly went wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to simulate N-sided biased die? def roll(N,bias): '''this function rolls N dimensional
I want to simulate this error so I can check a generic error page
Lets say I want to simulate a particle state, which can be normal (0)
I'm developing a Silverlight application where I want to simulate a console. There are
Please, I want to simulate dropdown select, but there will be just links, no
I have this button in an app. I want to simulate a tap on
I have one IP packet, which includes IGMP packet. I want to simulate this
If I want to simulate press on home button I do this Intent startMain
I want to simulate a FAM event. The API doesn't seem to support this.
Ok so i want to simulate the hardware previous button by doin this on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.