Announcement

Collapse
No announcement yet.

Two Windows, One app

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

  • Two Windows, One app

    I'm trying to integrate a second window that can't be a dialog box
    into an application. It seems it has to have it's own class. Is
    it ok for one app to have two classes??

    Best Regards

    Jim


    ------------------
    Jim Seekamp
    Jim Seekamp

  • #2
    Sure, you can have lots of different window classes in any application.

    But - it is not necessary for each window created by an application to have its won class; it *is* necessary, though, that your window procedure be able to handle messages from more than one window (the first parameter of the procedure) and keep any data separate.

    If you check out the PBNOTE sample supplied by PowerBASIC, you will see how to keep data separate for as many windows are created within the same class.

    MCM


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

    Comment


    • #3
      Jim,

      Do a search in the Source Code forum, I posted a Multiple Window
      example that is very close to what you are looking for. It does not
      use the MDI spec like PBNOTE.

      If you have any questions about it, just let me know I'll be glad to
      help you out with it.

      Regards,
      Jules

      Comment


      • #4
        Jim,

        If you need to, you can have as many window classes registered as you need,
        its the correct way to do it. Depending on what you require, you can use
        the existing WndProc to process the messages if you wish to use the same
        registered window class as the main app, you just need to be careful what
        you put in the WM_CREATE message or you will get it in both windows.

        Your adjustments are the window styles that you can normally combine that
        are documented under CreateWindow() in win32.hlp and of course you use the
        window handle from the parent in the second window. Depending on how you
        combine the styles, you can have the window contained within the parent's
        client area or you can have it free floating, depending on what you need.

        This technique gives you the most adjustments when using a child window and
        you can get some interesting results with it. There are the extended styles
        listed in CreateWindowEx() as well if you want to make a tool window or a
        window that is always on top.

        Regards,

        [email protected]

        ------------------
        hutch at movsd dot com
        The MASM Forum - SLL Modules and PB Libraries

        http://www.masm32.com/board/index.php?board=69.0

        Comment


        • #5
          Thanks for the responses!
          I always used dialogs after the main window up until now, so I
          wasn't sure. I've implemented the window and it works great!
          Thanks again.

          Best Regards

          Jim


          ------------------
          Jim Seekamp
          Jim Seekamp

          Comment


          • #6
            Jim,

            The code below shows two windows using DDT. Maybe, this will help
            a little. Hope I didn't misunderstand your question, and what this
            topic is about.

            Jules, I couldn't find your example in the source code. I searched
            under your name in that forum, but couldn't identify which topic you
            were referring to.


            Code:
            #COMPILE EXE
            #DIM ALL
            #INCLUDE "win32api.INC"
            DECLARE CALLBACK FUNCTION wndProc()
            GLOBAL endWnd1 AS BYTE
            
            FUNCTION PBMAIN
               LOCAL hWnd1 AS LONG, hWnd2 AS LONG, result AS LONG
               DIALOG NEW 0, "Test1", , , 200, 85, %WS_SYSMENU + %WS_CAPTION TO hWnd1
               DIALOG NEW 0, "Test2", , , 150, 120, %WS_SYSMENU + %WS_CAPTION TO hWnd2
               DIALOG SHOW MODELESS hWnd1, CALL wndProc TO result
               DIALOG SHOW MODAL hWnd2
               DO
                  DIALOG DOEVENTS
               LOOP UNTIL endWnd1
            END FUNCTION
            
            CALLBACK FUNCTION wndProc()
               SELECT CASE CBMSG
               CASE %WM_DESTROY
                    endWnd1 = 1
               END SELECT
            END FUNCTION
            ------------------


            [This message has been edited by Charles Dietz (edited September 01, 2000).]

            Comment


            • #7
              Charles; actually I was talking about creating a second window
              (as opposed to dialog) using createwindow and registering it's
              own class and message loop. I don't use DDT, but thanks
              for the response anyways.

              Best Regards

              Jim


              ------------------
              Jim Seekamp
              Jim Seekamp

              Comment


              • #8
                Charles,

                Sorry, the Source code forum only goes back 1 year. Drop me an email and
                I will forward you a copy. If you have Borje POFFS program and PB archives
                you will find it in there.

                Regards, Jules mailto:[email protected][email protected]</A>

                Comment


                • #9
                  Thanks Jules,

                  I found it in the source code archives.


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

                  Comment

                  Working...
                  X