Announcement

Collapse
No announcement yet.

How to hide DDT initially

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

  • How to hide DDT initially

    Guys --
    somebody know how to prevent initial appearence of DDT (at all, with minimum of code) ?
    It looks that Dialog Show Modal includes ShowWindow ... %SW_SHOW
    I know three workarounds, but they require relatively many operators or too exotic.

    Sample. If DDT has %WS_CAPTION:
    Code:
       Case %WM_SIZE
                Dim nSize As Static Long
                Incr nSize: If nSize = 1 Then ShowWindow CbHndl, 0
    Another two ways are even more terrible.

    ------------------
    E-MAIL: [email protected]

    [This message has been edited by Semen Matusovski (edited April 11, 2001).]

  • #2
    Don't know if this helps but this is the sample I think you gave me for making an invisible window...

    My assumption is that it will have to be modeless and do not do Dialog Show ???

    Dialog Show should have an option on it to add the SW_HIDE initially, or is that a windows thing?


    Code:
    hWnd = CreateWindowEx(0,szClassName, _
                          "", _
                          %WS_POPUP Or %WS_DLGFRAME,_
                          %CW_USEDEFAULT, _
                          %CW_USEDEFAULT, _
                          %CW_USEDEFAULT, _
                          %CW_USEDEFAULT, _
                          hParent, _ '<-- assign to a parent window
                          %NULL, _
                          hInstance, _
                          ByVal %NULL)
    
    'ShowWindow hWnd, iCmdShow
    UpdateWindow hWnd
    ------------------
    Scott
    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


    • #3
      Haven't tried this myself, but what if you make the style like..
      Code:
      DIALOG NEW.......   %WS_CHILD OR %WS_CAPTION [b]AND NOT %WS_VISIBLE[/b]...
      MCM
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Semen, what about creating the dialog outside of the visible
        desktop area?



        ------------------
        Bernard Ertl
        Bernard Ertl
        InterPlan Systems

        Comment


        • #5
          Scott --
          I am about exactly DDT.
          Michael --
          initial state is not important
          Code:
             #Compile Exe
             #Dim All
             #Register None
             #Include "Win32Api.Inc"
             
             Function PbMain
                Local hDlg As Long
                Dialog New 0, "Modal 1..",,, 200, 50, %WS_CAPTION Or %WS_SYSMENU To hDlg
                ShowWindow hDlg, 1: Sleep 3000: ShowWindow hDlg, 0: Sleep 3000
                Dialog Show Modal hDlg
             End Function
          or
          Code:
             #Compile Exe
             #Dim All
             #Register None
             #Include "Win32Api.Inc"
             
             Function PbMain
                Local hDlg As Long
                Dialog New 0, "Modal 1..",,, 200, 50, %WS_CAPTION Or %WS_SYSMENU To hDlg
                Dialog Show State hDlg, %SW_HIDE ' <-- "hide"      
                Dialog Show Modal hDlg
             End Function
          Bern --
          1) Not comfortable (I simply want to make same actions in WM_INITDIALOG before normal appearence).
          2) DDT is too "clever"
          Code:
             #Compile Exe
             #Dim All
             #Register None
             #Include "Win32Api.Inc"
             
             Function PbMain
                Local hDlg As Long
                Dialog New 0, "Modal 1..", 5000, 5000, 100, 100, %WS_CAPTION Or %WS_SYSMENU To hDlg   
                Dialog Show Modal hDlg
             End Function
          Alone, what I want - appearence similar SDK-windows : after a command "fas" (ShowWindow ..., %SW_SHOW)
          ------------------
          E-MAIL: [email protected]



          [This message has been edited by Semen Matusovski (edited April 11, 2001).]

          Comment


          • #6
            Semen,

            You can use:

            Code:
            DIALOG SET LOC hDlg, 5000, 5000
            between the DIALOG NEW & DIALOG SHOW.

            Put another DIALOG SET LOC in the WM_INITDIALOG when you are ready.

            That's the best solution that I can offer...



            ------------------
            Bernard Ertl
            Bernard Ertl
            InterPlan Systems

            Comment


            • #7
              The problem with displaying a dialog "outside" of the desktop at an arbitary location is that it may actually be visible in a multi-monitor PC!

              I've been working to get my G450 dual-head going (it hates my motherboard for some as-yet unknown reason), and hopefully I'll be able to figure out a way of enumerating all desktop positions that would help in this situation.

              Maybe someone has done this before me? I'd hate to have to reinvent the wheel here...

              On another note, it should be possible to use DIALOG SHOW STATE immediately after a DIALOG SHOW MODELESS statement...

              Alternatively, Post a message to the dialog (%WM_USER + 999&, etc), and respond in the dialog callback to set the visibility with DIALOG SHOW STATE. That way, it can be called "on demand" just by using PostMessage(), SendMessage(), DIALOG SEND, etc.

              ?


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

              Comment


              • #8
                I did everything in my power to make DDT invisible with no success, even doing the show state after the Dialog Show puts a trace on the screen so that SOMETHING showed, however brief. This is especially true on slower PC's as well where the video card may only be 512 or 1mb...

                Sorry Semen, was just a suggestion, that's the only way I could get it to work...
                I do suppose if you did that that you could use DDT on it after the fact, I've had SOME success mixing and matching although I doubt it's recommended...

                Perhaps if you created your own class? Is that possible? Using the CreatwindowEx as the class?
                That gets beyond me however.....


                Scott

                ------------------
                Scott
                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


                • #9
                  If you created a new Window (dialog) Class, then that would very likely work, but you'd not be able to use DDT, so you could just create a SDK or RC-style dialog without the %WS_VISIBLE...


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

                  Comment


                  • #10
                    Not sure if this is what you're after, but what about Steve Hutchesson's 1-byte-patch made to a compiled executable that made console apps run invisibly? Not sure if it'll work on GUI apps or not

                    Best of luck,
                    Wayne



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

                    Comment


                    • #11
                      Originally posted by Lance Edmonds:
                      I've been working to get my G450 dual-head going (it hates my motherboard for some as-yet unknown reason)
                      Lance,
                      I had a problem also with G450 dual-head graphics card. It seems that this
                      does NOT work with P2B motherboards. You need a P3B motherboard.

                      Kind regards
                      Eddy
                      [email protected]


                      ------------------
                      [email protected]
                      Eddy

                      Comment


                      • #12
                        Thanks for the info, but I'm not sure what a P2B motherboard is... Mine is a 5EH with an AMD/k266 socket 7. Plenty of folks with this board seem to have problems according to a search of the Matrox forums, however, many seem to have got it going too. After updating the BIOS 3 times, Win2K crashes at the very last 'bar' of the startup screen progress bar, but it reboots so fast I cant read the message.

                        I'm going to have to video the screen and pause the tape to read the message!



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

                        Comment


                        • #13
                          Semen,

                          Global Hook?

                          Or LockWindowUpdate GetDesktophWnd()
                          Flashes a little on release.

                          ------------------
                          hellobasic

                          Comment


                          • #14
                            Aldo --
                            I see, you deleted your suggestion.

                            Edwin --
                            Hooks are not a problem (I can detect even WM_NCCREATE), but can't understand how this way can prevent ShowWindow, which is inside "Dialog Show Modal".
                            Further I can hide a window without any problems, but flashes.

                            Just now typically I use a property, that Dialog Show Modal resizes a window, if there is %WS_CAPTION in Dialog New.
                            WM_SIZE (as I understand) occurs after ShowWindow, which does Dialog Show Modal, but before processing next message from query.
                            Can't say that this is a good method (unlike workable).


                            [This message has been edited by Semen Matusovski (edited April 12, 2001).]

                            Comment


                            • #15
                              Semen,

                              may be this one message will not be deleted...

                              I found you can minimize the DDT inside the WM_INITDIALOG section (ShowWindow CBHNDL, %SW_MINIMIZE). This works, without flashes - Don't know if it is sufficient for you...

                              Aldo

                              ------------------
                              Rgds, Aldo

                              Comment


                              • #16
                                This was the only thing i could make it to work.
                                Still, the current window loses focus..

                                Code:
                                #Compile Exe
                                 
                                Option Explicit
                                 
                                #include "win32api.inc"
                                 
                                CallBack Function DlgProc() As Long
                                 
                                    Static MayShow As Long
                                    Dim pWP As WINDOWPOS Ptr
                                 
                                    Select Case CbMsg
                                    Case %WM_INITDIALOG
                                 
                                        MayShow = 0
                                 
                                    Case %WM_WINDOWPOSCHANGING, %WM_WINDOWPOSCHANGED
                                 
                                        If MayShow = 0 Then
                                 
                                            pWP = CbLparam
                                            @pWP.Flags = @pWP.Flags And Not %SWP_SHOWWINDOW
                                            @pWP.Flags = @pWP.Flags And Not %SWP_NOACTIVATE
                                            @pWP.Flags = @pWP.Flags And Not %SWP_NOZORDER
                                            @pWP.Flags = @pWP.Flags Or %SWP_HIDEWINDOW
                                 
                                        End If
                                 
                                    Case 10000
                                 
                                        Sleep 2000
                                        MayShow = 1
                                 
                                        ShowWindow CbHndl, %SW_SHOW
                                 
                                    End Select
                                 
                                End Function
                                 
                                Function WinMain ( ByVal hCurInstance  As Long, _
                                                   ByVal hPrevInstance As Long, _
                                                   lpszCmdLine         As Asciiz Ptr, _
                                                   ByVal nCmdShow      As Long ) As Long
                                 
                                    Dim a       As Long
                                    Dim hDlg    As Long
                                    Dim Result  As Long
                                 
                                    Dialog New 0, "DDT Skeleton",,, 240, 180 _
                                        ,  %WS_OVERLAPPED _
                                        Or %WS_SYSMENU _
                                        Or %WS_MINIMIZEBOX _
                                        Or %WS_MAXIMIZEBOX _
                                        Or %WS_THICKFRAME _
                                        Or %WS_CLIPSIBLINGS _
                                        Or %WS_CLIPCHILDREN _
                                        To hDlg
                                 
                                    If hDlg = 0 Then Exit Function
                                 
                                '    Dialog Show Modeless hDlg Call DlgProc To Result
                                 
                                    PostMessage hDlg, 10000, 0, 0
                                 
                                    Dialog Show Modal hDlg Call DlgProc To Result
                                 
                                    Function = 1
                                 
                                End Function
                                ------------------
                                hellobasic

                                Comment


                                • #17
                                  Semen --

                                  Maybe I am missing something, but if you don't want your dialog to "show", why are you using DIALOG SHOW?

                                  The fact that the DIALOG NEW function returns a handle to the dialog must mean that the dialog is being created by that step, right? Why not just avoid using DIALOG SHOW until you want the dialog to become visible? Use a loop with DIALOG DOEVENTS and it seems like it should work exactly like a "normal" hidden window.

                                  -- Eric


                                  ------------------
                                  Perfect Sync Development Tools
                                  Perfect Sync Web Site
                                  Contact Us: mailto:[email protected][email protected]</A>
                                  "Not my circus, not my monkeys."

                                  Comment


                                  • #18
                                    Edwin --
                                    Yes, your way is workable, but this is exactly workaround.
                                    Of course, can be used another events
                                    Code:
                                       #Compile Exe
                                       Option Explicit
                                       #Include "win32api.inc"
                                       CallBack Function DlgProc As Long
                                          Static MayShow As Long
                                          Select Case CbMsg
                                             Case %WM_NCPAINT ' %WM_ERASEBKGND ' %WM_PAINT ' %WM_ERASEBKGND '
                                                Incr MayShow: If MayShow = 1 Then ShowWindow CbHndl, %SW_HIDE
                                             Case %WM_TIMER: ShowWindow CbHndl, %SW_SHOW: KillTimer CbHndl, 1
                                          End Select
                                       End Function
                                    
                                       Function PbMain
                                          Local hDlg As Long
                                          Dialog New 0, "DDT Skeleton",,, 240, 180 To hDlg
                                          SetTimer hDlg, 1, 3000, ByVal 0
                                          Dialog Show Modal hDlg Call DlgProc
                                       End Function
                                    But I don't understand, why it's necessary to search workaround.
                                    If I set SW_HIDE before Dialog Show, why engine "thinks" that it's more clever than a developer ?
                                    It's possible to understand default WS_VISIBLE, but when styles or state are defined explicity - sorry ...


                                    Eric --
                                    I prefer to have PbMain from two statements Dialog New/Dialog Show and to do all in callback.
                                    Is there another than Dialog Show way to set "DDT" callback ?
                                    I am ready to use Dialog Hide Modal hDlg Call DlgProc, but can't find this statement in PB manual

                                    ------------------
                                    E-MAIL: [email protected]

                                    Comment


                                    • #19
                                      > Is there another than Dialog Show way to set "DDT" callback ?

                                      You're right, I forgot that DIALOG SHOW specifies the callback function, so you have to use it.

                                      Is this your program's main dialog? And if so, is it important to keep the Task Bar button from appearing too?

                                      Have you tried creating a dialog with a height and/or width of zero?

                                      -- Eric

                                      ------------------
                                      Perfect Sync Development Tools
                                      Perfect Sync Web Site
                                      Contact Us: mailto:[email protected][email protected]</A>
                                      "Not my circus, not my monkeys."

                                      Comment


                                      • #20
                                        I've done the height-Width at zero and you still get a pixel on teh screen and the taskbar shows a box...so if hiding it is the intention it doesn't work




                                        ------------------
                                        Scott
                                        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

                                        Working...
                                        X