Announcement

Collapse
No announcement yet.

Taskmanager changes my window!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Taskmanager changes my window!

    I have an application, in which I believed I had everything possible covered, but users always seem to find loopholes....
    My applications screen is maximized, non moveable, no min/max box, because it should always be full-screen, on top. That works fine.
    But a user of the program has used taskmanager to minimize my application. (taskmanager seems to be able to resize every window, also non resizeable ones...)
    Is there a way to prevent this? (Tried to catch WM_ACTIVATE, but that doesn't seem to do it...)


    ------------------
    Peter.
    mailto[email protected][email protected]</A>
    Regards,
    Peter

  • #2
    While your app breaks a lot of the "rules" that define "good" GUI interface behavior, you could try intercepting %WM_WINDOWPOSCHANGING, adjusting the entries in the WINDOWSPOS structure that is pointed to by LPARAM (CBLPARAM for DDT callback's) in order to resist the attempt to change your window's position/size.

    Also take a look at WM_WINDOWPOSCHANGED... this one is sent after the size/move adjustment occurs.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      You could catch the WM_Minimize or whatever is the message, and then issue a WM_MAXIMIZE couldn't you?

      That would be clumsy but would work...
      The window would have been minimized already and then maximized vs catching it as lance showed...

      Scott


      ------------------
      Scott
      mailto:[email protected][email protected]</A>
      MCSE, MCP+Internet
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        Well, that message needs a little bit of support:

        In technical or scientific environments or in business
        environments, a primary application usually runs full-screen
        and without a minimize option. I can say that from a civil
        engineering background.

        An obvious exception in business environments could be the
        operation of MS Word and MS Excel.

        So it's consumer software that runs minimized and with the option
        to maximize.



        ------------------

        Comment


        • #5
          Rules? Check out a microslop file/open dialog and the range of administration tools
          which accompany their products. The file/open dialog remembers no previous settings
          and is hideously designed with no resizing available. If rules are based on the non-uniformity of
          microsoft's own inabilities or inept efforts at GUI design within their repetoire of
          support apps and tools for their products, then it must be assumed there are no real
          rules. It's a free-for-all! Do you go by what microsoft says or by what the summer-break
          college kids who write their drivers and trivial, buggy apps create with no obvious design
          contraints or rules?

          Striving towards a gatesless desktop!





          ------------------
          Ron

          Comment


          • #6
            My application is a telephone call recording system. It's the only program running on the system, and may not be minimized. (I could probably be better off and quicker using a DOS application, but customers nowadays like Windows GUI).
            This also reduces the chance of personel playing games on these machines. (it happens!...). I'll give all suggestions a try, thanks!



            ------------------
            Peter.
            mailto[email protected][email protected]</A>
            Regards,
            Peter

            Comment


            • #7
              This is enough agressive code (at least, under Win2000 on my PC)
              (some features added later)
              Code:
                #Compile Exe
                #Register None
                #Dim All
                #Include "Win32Api.Inc"
                
                Sub pSetForegroundWindow(hwnd As Long)
                   Do
                      Dim lForeThreadID As Long, lThisThreadID As Long, hWndF As Long
                      hWndF = GetForegroundWindow: If hwnd = hWndF Then Exit Sub
                      lForeThreadID = GetWindowThreadProcessId(hWndF, ByVal 0&)
                      lThisThreadID = GetWindowThreadProcessId(hwnd, ByVal 0&)
                      If lForeThreadID <> lThisThreadID Then _
                         AttachThreadInput lForeThreadID, lThisThreadID, %True
                      SetForegroundWindow hwnd
                      If lForeThreadID <> lThisThreadID Then _
                         AttachThreadInput lForeThreadID, lThisThreadID, %False
                      If IsIconic(hwnd) Then ShowWindow hwnd, %SW_RESTORE Else ShowWindow hwnd, %SW_SHOW
                      hWndF = GetForegroundWindow: If hwnd = hWndF Then Exit Sub
                      ShowWindow hWndF, %SW_MINIMIZE
                      hWndF = GetForegroundWindow: If hwnd = hWndF Then Exit Sub
                      ShowWindow hWnd, %SW_MINIMIZE: ShowWindow hWnd, %SW_RESTORE
                   Loop
                End Sub
                
                Global DlgProcOr As Long ' Make not moveable
                CallBack Function DlgProcSC
                   Local Result As Long
                   Result = CallWindowProc(DlgProcOr, CbHndl, CbMsg, CbWparam, CbLparam)
                   If CbMsg = %WM_NCHITTEST Then If Result = %HTCAPTION Then Result = %HTNOWHERE
                   Function = Result
                End Function
                
                CallBack Function DlgProc
                   Select Case CbMsg
                      Case %WM_ACTIVATEAPP, %WM_ACTIVATE: PostMessage CbHndl, %WM_USER + 1, 0, 0
                      Case %WM_USER + 1
                         pSetForegroundWindow CbHndl
                         SetWindowPos CbHndl, %HWND_TOPMOST, 0, 0, _
                            GetSystemMetrics(%SM_CXSCREEN), GetSystemMetrics(%SM_CYSCREEN), 0
                      Case %WM_DESTROY: SetWindowLong CbHndl, %GWL_WNDPROC, DlgProcOr
                   End Select
                End Function
                
                Function PbMain()
                   Local hDlg As Long
                   Dialog New 0 ,"Hello", , , 0, 0, %WS_CAPTION Or %WS_SYSMENU To hDlg
                   Control Add TextBox, hDlg, 101, "", 10, 10, 170, 12
                   Control Add TextBox, hDlg, 102, "", 10, 30, 170, 12
                   DlgProcOr = SetWindowLong(hDlg, %GWL_WNDPROC, CodePtr(DlgProcSC))
                   Dialog Show Modal hDlg Call DlgProc
                End Function
              [This message has been edited by Semen Matusovski (edited July 09, 2000).]

              Comment


              • #8
                If you want your application to have full hold of the desktop, then change the shell=explorer.exe in the [Boot] system.ini to your program name, this prevents the user from having *any* access to the rest of the PC files.

                This works in Win '95/'98, I don't know about NT/2k.

                Regards,


                ------------------
                Kev G Peel
                KGP Software
                Bridgwater, UK.
                mailto:[email protected][email protected]</A>

                Comment

                Working...
                X