Announcement

Collapse
No announcement yet.

Building a dialog and keep it totally unvisible during load.

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

  • Building a dialog and keep it totally unvisible during load.

    I'd like to make the following small Dialog unvisible on start of the DLL containing it:
    Code:
    '-------------------------------------------------------------------------------------------------------
    ' DIALOG
    '-------------------------------------------------------------------------------------------------------
    sub Watch(tfVisible as long)
    	'INPUT:
    	'tfVisible = 1: Dialog sichtbar
    	'tfVisible = 0: Dialog unsichtbar
    	LOCAL hDlg AS LONG
    	DIALOG NEW 0, "I B D WinInfo",,, 200, 80,, %WS_EX_TOOLWINDOW, TO hDlg 'Window nicht in Taskbar zeigen
    	CONTROL ADD TEXTBOX, hDlg, 40, "", 4, 4, 190, 70, %ES_MULTILINE OR %ES_WANTRETURN OR %WS_VSCROLL, %WS_EX_CLIENTEDGE
    	Dialog Show Modeless hDlg Call DlgProc
    	'Die Reichweite des Mauscursors auf den MCADD-Frame beschränken.
    	'0& anstelle von GetHwndFrame() würde sich auf den gesamten Desktop-Inhalt beziehen.
    	if tfVisible = 0 then
    	   SetWindowPos hDlg, %HWND_NOTOPMOST, GetHwndFrame(), 0, 0, 0, %SWP_HIDEWINDOW or %SWP_NOSIZE OR %SWP_NOMOVE
    	ElseIf tfVisible = 1 Then
    	   SetWindowPos hDlg, %HWND_TOPMOST, GetHwndFrame(), 0, 0, 0, %SWP_SHOWWINDOW or %SWP_NOSIZE OR %SWP_NOMOVE
    	end if
    End Sub
    As you can see, the above dialog is startable with option tfVisible.
    When the DLL starts the dialog flickers for a tenth of a second and then disappears. But I'd like it to be unvisible at all with tfVisible = 0. How could I achive this even if the dialog is built during the load of the DLL?
    Norbert Doerre

  • #2
    Code:
    DIALOG SHOW STATE hDlg, %SW_HIDE
    DIALOG SHOW MODELESS Call DlgProc
    Adam Drake
    PowerBASIC

    Comment


    • #3
      Hide dialog

      Adam, thanks for your hint - and all is running perfectly.
      Norbert Doerre

      Comment


      • #4
        This may be semantic .. or one of those "it doesn't translate well" things ....but
        When the DLL starts ...
        DLLs do not "start"

        (or "End" for that matter).

        How could I achive this even if the dialog is built during the load of the DLL?
        When a DLL is loaded to a process space, nothing else is happening except for the execution of whatever you have coded in your entry-point function (LIBMAIN).

        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Private comment

          Michael, sorry for my bad English. I'm working on it.... But simply try to write Your last comment in German via email to me, because this is not a forum for semantic, and You'll certainly get back my more eloquent answer.
          Norbert Doerre

          Comment


          • #6
            A dll starts and ends in it's libmain()
            hellobasic

            Comment


            • #7
              Start and end must be a European thing.

              (And you should know better, Edwin. DLLs are "loaded" and "unloaded." It's PROCEDURES which "start" and "end."')

              Mr. Doerre, we might have made a guess that English may not be your primary language if you would have completed your forum profile to show your location.

              When I see someone is from a European country I watch out for translation issues when responding. (Yes, that makes me one of those insensitive culturally-deficient Yanks. Tough.)

              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Sorry Edwin, technically MCM is correct.
                From the help files
                LIBMAIN (or its synonym DLLMAIN) is an optional user-defined function called by Windows each time a DLL is loaded into, and unloaded from, memory
                Start/Stop could be correct if thinking only in terms of your process (Parent program) that in the scope of it, Start = LOAD and Stop = UnLoad

                But this would only be true if your process was the only process to have contact with the dll.

                Robert,
                Somewhere here is an example that uses SDK to create its Window but be invisible until told to show (unfortunately I have been searching for that sample again now that I need it, so there is no flicker of a Window showing) although I am glad you found a solution for your problem.

                By the way, if I ever get back to ole' deutchesland again, I will have to look you up and we can make a run to the "Green Goose"
                Engineer's Motto: If it aint broke take it apart and fix it

                "If at 1st you don't succeed... call it version 1.0"

                "Half of Programming is coding"....."The other 90% is DEBUGGING"

                "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                Comment


                • #9
                  > MCM is correct.

                  I get that a lot.
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment

                  Working...
                  X