Results 1 to 14 of 14

Thread: Block Show Desktop / Windows-D only for my app

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2016
    Posts
    15

    Question Block Show Desktop / Windows-D only for my app

    Hello,
    Please help me,
    I want to stay on the desktop application when pressed lwin + d or show desktop button,
    Topmost not want to stay in all the time,
    fail at all
    Last edited by VBEdw; Feb 1st, 2016 at 05:10 AM.

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2016
    Posts
    15

    Re: Block Show Desktop / Windows-D only for my app

    No one can help me?

  3. #3
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Block Show Desktop / Windows-D only for my app

    I'm not sure you can, at least not trivially. The Show Desktop message is happening at an OS level so is going to override anything that's happening at an application level. You might be able to do it with some kind of API hack.

    Why would you want to anyway? A user asking to be shown their desktop wants to be shown their desktop. Any attempt to prevent them from doing so is unlikely to be received well.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2016
    Posts
    15

    Re: Block Show Desktop / Windows-D only for my app

    Hello,
    Possibly I have not written well, sorry for English,
    it is a simple digital clock
    I want to stay always on your desktop
    not disappear pushbutton show desktop were lwin + d = show desktop,
    So it's not something illegal
    there is no way not to go, because there gagets for windows
    example: http://www.ruprograms.ru/uploads/pos...mage-75738.jpg

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Block Show Desktop / Windows-D only for my app

    Gadgets (or widgets) are not normal applications. They are built a special way. That is what lets them be embedded in the desktop (and is why they are immune to the "show desktop" because they are part of it.) But since yours is an app, it's going to be floating over, which means there could be somethign under it (like a document that the user needs.)
    Long story short - gadgets need to be written against a specific SDK & Interface so that it can be registered with the system as a gadget and run properly.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Block Show Desktop / Windows-D only for my app

    Speaking of which, is there any reason you don't develop your clock as a widget? I've never actually developer a widget but I'm willing to bet it's a lot easier than the sort of hacking you're going to have to do to make it work otherwise.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  7. #7
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Block Show Desktop / Windows-D only for my app

    He sent me a PM asking about how to do a widget... I haven't looked at how to write one since they first showed up in Win7. If I remember right, they are developed as html/js packages, zipped up, along with some additional files for support - manifest, things like that - given a new extension and then they can be registered with the system for display. I've never had a need for them or now, so I've never looked into it too much in the last 10+ years.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Block Show Desktop / Windows-D only for my app

    He sent me a PM asking about how to do a widget
    Yay! We've steered someone in the right direction. The forum works

    VBEdw, if and when you manage to get your head round them it'd be great if you could post some useful resources back. That way we can all learn from your journey. Good luck.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2016
    Posts
    15

    Re: Block Show Desktop / Windows-D only for my app

    Hello again,
    what I want is possible, but not perfect
    press Win + d work, but remains in topmost
    press show desktop button not work, It is normal because it is not defined,
    I do not know what the show desktop button uses

    Code:
    Public Class Form1
        Private Declare Function GetKeyState Lib "user32" (ByVal vKey As Integer) As Short
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            ' If GetKeyState(91) And GetKeyState(68) Then
            If GetKeyState(Keys.LWin) And GetKeyState(Keys.D) Then
                Me.TopMost = True
                Me.TopMost = False
            End If
        End Sub
    End Class
    and yes, there are beginner and want to learn,
    I do not think this is possible,
    nobody has an idea of how to solve ?
    sorry for English,
    is the last request and post, and thank you very much .

  10. #10
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Block Show Desktop / Windows-D only for my app

    There is not a direct API way to disable the Show Desktop shortcut, outside of something I know for certain is against this forum's guidelines. Let's talk a little bit. Spend some time thinking about this.

    "It is not possible" is not a thing that is often true in Windows. What is more often the accurate statement is, "there is no easy way", or "you are discouraged from doing this", or "someone has found a way but it is janky and unreliable." Usually, when one or more of these statements are true, it is because Microsoft has decided that the task in question is something they do not want applications to do.

    This question has nothing to do with TopMost, though that's a really common question for something that falls afoul of this. You want something that is on the desktop even if the "Show Desktop" shortcut is displayed. The "right" way to do this is to write a Windows Gadget, but that's kind of dubious. Here's the history of Gadgets:
    • They released in Vista, and a few were on the desktop by default. Most people didn't know or care what they were, and kept the same default ones forever.
    • They got an overhaul in Win7, and a new application called Windows Sidebar hosted them.
    • They are discontinued in Windows 8 onwards, because applications can implement Live Tiles that have many of the same functionalities.


    .NET has no built-in classes to help you write a gadget, and some various internals of .NET might make it unwise to do so. To write one, you'd have to wrap some API yourself (or find an article showing you how), and follow the rules of writing a Windows Gadget. Then you will get exactly what you want, the way Microsoft intends, but it will only work on Windows Vista and Windows 7. If you want to do something like it on Windows 10, you have to settle for a Live Tile, which does have built-in .NET support if you're using the Windows Runtime and making a Windows Store application.

    If you don't want to use those, the official channels for making widgets, you're mostly on your own. Intercepting Windows-D is not a thing that is encouraged, because it has a very clear purpose of clearing away all windows. If it clears away all windows, "except for ones I think are super important", then problems happen if applications start indicating they're super-important. We see this happen a lot when someone wants to be "super for real topmost", always on top of other applications even if that other one wants to be topmost. There are ways to do it, but when two applications implement those techniques, you end up with two applications fighting for TopMost in a way that makes it impossible to use or close either application. It's not fun. I suspect trying to "defeat" Windows-D will have similar frustrations and hurdles.

    I think writing an application that behaves like a clock is a good project for a beginner. I think making it behave like a widget is more like a good project for an expert. It will involve either using API to do things the Gadget way or using API to try and defeat a well-defined Windows feature in a way Microsoft discourages. Neither of those are easy.

    And, as evidence that it's not easy, I can't name a popular application that does it. (I also can't name a popular application that implemented a Windows Gadget.) If no one else has done it, that is a good indicator that no one knows how to do it and/or if people have tried, they didn't succeed. When seeking beginner projects, stick to things you've seen applications that make money do.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  11. #11
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Block Show Desktop / Windows-D only for my app

    Since this has likely gone on for far too long, I think I'll point out the simple and obvious ... when a form is minimized (whether it be the user clicking the minimize button, or windows minimizing all apps for a show desktop) ... the resize event does fire off... interestingly enough, you can then reset the WindowState of the form within the resize event too... no timers. No keyboard hooks, no muss no fuss. What you CAN't tell is who initiated the minimize. If that's important too... well....


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  12. #12

    Thread Starter
    New Member
    Join Date
    Jan 2016
    Posts
    15

    Re: Block Show Desktop / Windows-D only for my app

    Hi all
    @techgnome
    events only works when the application is selected,
    for example if you selected browser, the application does not consider any event,
    I understand their @Spynne, as Windows does not allow my wish
    but I do not quit, I'll find a way, do not quit that easy: P
    Thank you for advice .

  13. #13
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: Block Show Desktop / Windows-D only for my app

    You are effectively trying to do something that your application will never be designed to do - this isn't about solving a problem, it's like trying to break down a wall using your skull. The problem is, you are doing it wrong.

    Also, applications which do this are annoying and foolish. It is easy to prevent the application from running, and doing stuff to break the user interaction with the operating system.

    What you need to do is investigate computer management, policies, and computer configuration - if this is, for example, a kiosk application, which may have legitimate reason to do such things, then you should be managing the system that way, not through a windows application.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  14. #14
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Block Show Desktop / Windows-D only for my app

    Quote Originally Posted by SJWhiteley View Post
    You are effectively trying to do something that your application will never be designed to do - this isn't about solving a problem, it's like trying to break down a wall using your skull. The problem is, you are doing it wrong.

    Also, applications which do this are annoying and foolish. It is easy to prevent the application from running, and doing stuff to break the user interaction with the operating system.

    What you need to do is investigate computer management, policies, and computer configuration - if this is, for example, a kiosk application, which may have legitimate reason to do such things, then you should be managing the system that way, not through a windows application.
    If it was a full-screen app we were talking about, I'd agree... but we're not... what he's trying to do is build a Windows Gadget ... but rather than take hte time to investigate and do it properly, he's trying to use a sledgehammer to get it to do his bidding... which I do agree is foolish and annoying.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width