Results 1 to 17 of 17

Thread: Lock Screen

  1. #1
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Lock Screen

    I want to make a lock screen like the one Windows does when u log off.
    A full screen which u cannot minimize or close or switch to other applications. just normal lock screen.
    any API's, ideas or any guides?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    This is going to be completely different depending on the targetted OS and your requirements. Do you want to block ALT+F4? How about ALT+TAB or WindowsKey+TAB (Vista and above), or WindowsKey+D, etc?

    Maybe immitating a screen saver would be the way to go, as in SystemParametersInfo (SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);

    I've no idea about Linux or Mac though.

  3. #3
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    thanks for replying

    1- my target is Windows
    2- yes I want to disable all the keys you mentioned
    3- I will try ur advice and give u feedback

  4. #4
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    I didn't get any luck about immitating screen saver

    any help ? I want to implement a custom full screen widget that locks the screen
    Last edited by ahmdsd_ostora; 9th July 2010 at 17:58.

  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    Which is what a screen saver does.

    Which part of you struggling with?

  6. #6
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    SystemParametersInfo (SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);

    I don't understand where to find this !!

    no info in the docs

  7. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    It's an OS specific function, as stated.

    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

  8. #8
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    thanks alot for help,

    I tried to set the parameter as u told me but the method returns false:

    Qt Code:
    1. bool prevState=0;
    2. bool result;
    3.  
    4. result=SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &prevState, 0);
    To copy to clipboard, switch view to plain text mode 

    but i get result = false

    I am working on Windows 7

  9. #9
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    Did you call GetLastError to find out why? http://msdn.microsoft.com/en-us/libr...60(VS.85).aspx

  10. #10
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    thanks again, I think it's a compatibility issue, so I decided to change the strategy.

    now I have a screen that I disabled close events for it, set it to full screen, working well.

    the only problem now is to disable the (alt + tab ) combination or any key combination that lets the OS raise another application on the top.

    can I do that using event catching?

  11. #11
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    No, as it's another system function.

    Its doubtful it's a compatibility issue, more likely to be that your application has insufficient priviledges to execute the stated command on Windows 7. You would probably have to request administrative priviledges (or at least, elevated priviledges) in your applications manifest.

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Lock Screen

    You could try grabbing the keyboard and mouse, I don't know if that overrides the system hotkeys but you can try it. But still your application could be closed/deactivated by another software. It would be good if you said why you need this functionality.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    I need this functionality because my application should prevent kids at certain times from continuing sitting on the PC , so it will show the lock screen at these times and have a password that is different from the Windows account password.

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Lock Screen

    Why reinvent the wheel? Can't you use the parental control facilities built into Windows? The moment the kids learn what Ctrl+Alt+Del does, your app will be useless. And kids learn fast these days
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #15
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    Ctrl+Alt+Del will fail in showing the apps list as I said in the other topic
    If u have any material that show me how using the parental control facilities, please tell me.

  16. #16
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

  17. The following user says thank you to Lykurg for this useful post:

    ahmdsd_ostora (11th July 2010)

  18. #17
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Lock Screen

    Thank u, I will start reading

Similar Threads

  1. Lock a file
    By euthymos in forum Qt Programming
    Replies: 22
    Last Post: 27th December 2010, 23:29
  2. Replies: 2
    Last Post: 11th June 2010, 07:23
  3. Lock a row in QTreeWidget
    By maka3k in forum Qt Programming
    Replies: 1
    Last Post: 9th March 2010, 13:45
  4. QMutex seems not to lock()
    By sylvaticus in forum Qt Programming
    Replies: 18
    Last Post: 4th December 2009, 10:39
  5. appbar: allocate screen space (dock and lock)
    By mito in forum Qt Programming
    Replies: 1
    Last Post: 20th April 2007, 18:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.