Results 1 to 19 of 19

Thread: [RESOLVED] It is possible to lock the Z order of a form?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Resolved [RESOLVED] It is possible to lock the Z order of a form?

    I want that a particular form in my app get the backplane Z order ALWAYS, no matter what, but not only from the APP, but the whole screen, regardless how many app there is in.

    Is to say that any other app or form can cover ir, but I still want that this particular form catch the focus if the user want to click in the form, but it can't has the foreplane about Z order, but it can has the focus.

    it is possible?.

    HINT: I want to partially replace the Windows Desktop, so I want the original Windows desktop -> that particular form -> any other form AND/OR any other app ----> user P.O.V

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    I tryed the SetWindowPos with BOTTOM , in the Form_Activate (it works the first time the form load), then tryed on the Form_GetFocus for the next time the Form catchs the focus, but it don't work because VB6 first runs the event GetFocus's code and then runs internally the SetWindowPos to make sure it is in front.

    Then I place the SetWindowPos in the Form_CLICK event, and it kind of work, but it goes in front and quickly go back again maintaining the focus. That visual effect is not wanted, apart of placing the call SetWindowPos in every single object which the user can touch inside the form is not an ideal solution.

    In other thread saw, setParent with the Windows desktop, but didn't provide how to get the handle to that syslikstview form?.-

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    Well, just found this code, works great... it does the bind.

    I wonder as it is looking for specific things in the Window's desktop, if it realiable in all windows versions?


    Code:
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
                    ByVal lpClassName As String, _
                    ByVal lpWindowName As String) As Long
                    
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _
                    ByVal hWnd1 As Long, _
                    ByVal hWnd2 As Long, _
                    ByVal lpsz1 As String, _
                    ByVal lpsz2 As String) As Long
                    
    Private Declare Function SetParent Lib "user32" ( _
                    ByVal hWndChild As Long, _
                    ByVal hWndNewParent As Long) As Long
     
    Private Sub Form_Load()
        Dim ProgMan&, shellDllDefView&, sysListView&
        
        ProgMan = FindWindow("progman", vbNullString)
        shellDllDefView = FindWindowEx(ProgMan&, 0&, "shelldll_defview", vbNullString)
        sysListView = FindWindowEx(shellDllDefView&, 0&, "syslistview32", vbNullString)
        
        SetParent Me.hwnd, sysListView
    End Sub

  4. #4
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: It is possible to lock the Z order of a form?

    I occasionally have searched for this ability.
    I call it making my program (it's main form) bottommost (I have trademarked/copyrighted/whatever that name)
    I believe I have collected a couple of solutions, but don't recall if I fully checked them out.
    Could you (or others) confirm if your solution is really bottommost ?

    Rob
    PS The other name that I trademarked/copyrighted/whatever is mediumized
    That is when you change the state of a window to a size somewhere between maximized and minimized

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: It is possible to lock the Z order of a form?

    Seriously, stop trying to create malware.

    You do not own the user's Desktop.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    Quote Originally Posted by dilettante View Post
    Seriously, stop trying to create malware.

    You do not own the user's Desktop.
    It is an advice for me?

    If so..., no I don't do malware, I have a name and honour.

    I am expanding my commercial software suit for cyber-coffe (lan gaming houses) from current to E-SPORTs platform.

    Before I didn't need to cover the normal window's desktop background, now I was needing do just that.

    Visit http://www.flulpycrea.com.ar/wp/ (if you reads Spanish) or visit any youtube video with the keyword FlulpyCrea.

    Thanks you for speak out your worries.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    Quote Originally Posted by Bobbles View Post
    I occasionally have searched for this ability.
    I call it making my program (it's main form) bottommost (I have trademarked/copyrighted/whatever that name)
    I believe I have collected a couple of solutions, but don't recall if I fully checked them out.
    Could you (or others) confirm if your solution is really bottommost ?

    Rob
    PS The other name that I trademarked/copyrighted/whatever is mediumized
    That is when you change the state of a window to a size somewhere between maximized and minimized
    Yes, this last method I post works great bottom most, but I didn't tested it in Windows 8 or upper, and I wonders if it also works covering the TILE MENU of windows 8, that ugly UI from Microsoft.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    Quote Originally Posted by dilettante View Post
    Seriously, stop trying to create malware.

    You do not own the user's Desktop.
    Another thing, I don't thinks this code takes in any way the User's Desktop credentials, or have anything to do with credetials at all.

    It only does is to place the window form in the Z order "tree" from the desktop.

    Indeed, my APP normally runs in elevated administrator mode, and refuses to run without those credentials, to be compatible with Windows 10, etc.

    So there is thousands and thousands (if not dozens of thousands) of gaming PCs and not so "gaming" PCs, thrusting just ME!, with maybe fiber optic or 30MB-100MB VDSL 2 internet connections!!!!.

    Why?, I never sent bloatable / malware, I never sent publicity on the shareware version, I have gaming in mind, no want those ****.
    Last edited by flyguille; Jun 2nd, 2017 at 09:29 AM.

  9. #9
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: It is possible to lock the Z order of a form?

    Quote Originally Posted by flyguille View Post
    Yes, this last method I post works great bottom most, but I didn't tested it in Windows 8 or upper, and I wonders if it also works covering the TILE MENU of windows 8, that ugly UI from Microsoft.
    If you attach your project (or working subset), I will test in W7 Pro 32bit and W10 Pro 32bit, if you wish

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    check this executable, it will be empty of content and no skin applied, but for the purpose of this test will work. Ah, no CLOSE button in the UI, you must kill the process then.

    http://www.flulpycrea.com.ar/FlulpyD...d/VDesktop.exe

    It is digitally signed if you want to check for safety.

    https://virustotal.com/es/file/9ed10...is/1496500046/

  11. #11
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: It is possible to lock the Z order of a form?

    I got this error on running VDesktop.exe then terminate.

    Code:
    ---------------------------
    VDesktop
    ---------------------------
    Run-time error '429':
    
    ActiveX component can't create object
    ---------------------------
    OK   
    ---------------------------



  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    Quote Originally Posted by 4x2y View Post
    I got this error on running VDesktop.exe then terminate.

    Code:
    ---------------------------
    VDesktop
    ---------------------------
    Run-time error '429':
    
    ActiveX component can't create object
    ---------------------------
    OK   
    ---------------------------
    the DLL hell.

    try to place it next to the EXE

    http://www.flulpycrea.com.ar/FlulpyD...MouseWheel.dll

    and

    http://www.flulpycrea.com.ar/FlulpyD.../GfxFlulpy.dll

  13. #13
    Hyperactive Member
    Join Date
    Aug 2017
    Posts
    380

    Re: It is possible to lock the Z order of a form?

    Try this alternative solution:

    Quote Originally Posted by Victor Bravo VI View Post
    The following code will put a Form always behind/at the bottom of all top-level windows. This is accomplished by processing the WM_WINDOWPOSCHANGING message.

    Code:
    Option Explicit     'In a standard .BAS module
    
    Private Declare Function DefSubclassProc Lib "comctl32.dll" Alias "#413" (ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Declare Function SetWindowSubclass Lib "comctl32.dll" Alias "#410" (ByVal hWnd As Long, ByVal pfnSubclass As Long, ByVal uIdSubclass As Long, Optional ByVal dwRefData As Long) As Long
    Private Declare Function RemoveWindowSubclass Lib "comctl32.dll" Alias "#412" (ByVal hWnd As Long, ByVal pfnSubclass As Long, ByVal uIdSubclass As Long) As Long
    Private Declare Sub PutMem4 Lib "msvbvm60.dll" (ByVal Ptr As Long, ByVal Value As Long)
    
    Public Function Subclass(ByRef Frm As VB.Form) As Boolean
        Subclass = SetWindowSubclass(Frm.hWnd, AddressOf SubclassProc, ObjPtr(Frm))
    End Function
    
    Public Function UnSubclass(ByRef Frm As VB.Form) As Boolean
        UnSubclass = RemoveWindowSubclass(Frm.hWnd, AddressOf SubclassProc, ObjPtr(Frm))
    End Function
    
    Private Function SubclassProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal uIdSubclass As Long, ByVal dwRefData As Long) As Long
        Const WM_WINDOWPOSCHANGING = &H46&, HWND_BOTTOM = 1&, SIGN_BIT = &H80000000
    
        If uMsg <> WM_WINDOWPOSCHANGING Then
            SubclassProc = DefSubclassProc(hWnd, uMsg, wParam, lParam)
        Else
            PutMem4 (lParam Xor SIGN_BIT) + 4& Xor SIGN_BIT, HWND_BOTTOM    'WINDOWPOS.hWndInsertAfter = HWND_BOTTOM
        End If                                                              'Xor: Unsigned pointer arithmetic
    End Function
    Usage example:

    Code:
    Option Explicit     'In Form1
    
    Private Sub Form_Load()
        Subclass Me
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        UnSubclass Me
    End Sub

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

    Re: It is possible to lock the Z order of a form?

    Depending on whether you want the desktop accessed or not... have you thought about a Kiosk app instead. There's a registry setting that you can change to your app that would then make your app the shell interface rather than Windows. You have to be careful with it though because you'll also probably want a way to reset it back to original settings for troubleshooting and other diagnostics. But if you google "windows kiosk mode" you should be able to find relevant info on it.

    -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??? *

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    Quote Originally Posted by Victor Bravo VI View Post
    Try this alternative solution:
    interesting..... checking it later

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    Quote Originally Posted by techgnome View Post
    Depending on whether you want the desktop accessed or not... have you thought about a Kiosk app instead. There's a registry setting that you can change to your app that would then make your app the shell interface rather than Windows. You have to be careful with it though because you'll also probably want a way to reset it back to original settings for troubleshooting and other diagnostics. But if you google "windows kiosk mode" you should be able to find relevant info on it.

    -tg
    About this, no, we have a policy of no interfering/sumplanting the Windows itself, we learn that it is the worst a kiosk program can do!. Overall that todays it is or frozen machines, or virtualized machines (diskless)

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: It is possible to lock the Z order of a form?

    I didn't know that forms are "asked" to change its Z position, and the form has the power of overpower its position forcefully. FANTASTIC.

  18. #18
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: [RESOLVED] It is possible to lock the Z order of a form?

    What was your final solution ?
    Rob
    PS I hate with a vengeance MS calling programs 'apps'

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    894

    Re: [RESOLVED] It is possible to lock the Z order of a form?

    Quote Originally Posted by Bobbles View Post
    What was your final solution ?
    Rob
    PS I hate with a vengeance MS calling programs 'apps'
    technically apps = inshort for applications.

    applications were using since so many years ....., which is the problem with that?



    about the solution, the code posted Victor Bravo VI, works perfect, plus I already was sub-classing for mousewheel control, so, easy insert.

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