Announcement

Collapse
No announcement yet.

Replacing a PPT with PowerBASIC program

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

  • Replacing a PPT with PowerBASIC program

    I have a simple presentation in Power Point that people can touch for information. Three issues make me want to do this in PowerBASIC (CC).

    Screen saver does not work in PP viewer, no timer on a slide to jump to the home slide directly and I own PBCC4/PBWin7 and looking to use them.

    I started in PBWin70 but could not figure out how to turn the [X] close box and dialog frame off. As this is a touch screen so you know someone will come and touch the [X] and close it and mess with the machine.

    So I thought about using PBCC, display a graphic, monitor mouse position and display the next graphic, delay and reload the main graphic.

    Anyone have something close to this to get me started or know of a better idea. I thought it would be simple, but not so far. Need a full screen graphics displayer and mouse samples.

    Thanks for any help

  • #2
    You might want to look for a COM interface for PowerPoint. That might give you some real control over things.

    Fire up your COM browser and see if anything interesting appears in the list of available libraries.

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

    Comment


    • #3
      Here is a post about a similar application...

      One From Column A, One from Column B..

      ... and you can even download and run that application by following the links.

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

      Comment


      • #4
        Hi,

        to create fullscreen GRAPHIC, you should be able to do something like this in PB/CC4 (not sure, tested in PBWIN/9):
        Code:
          ...
        
          LOCAL dx, dy AS LONG
        
          ' -- We will retrieve desktop size
          DESKTOP GET SIZE TO dx, dy
          
          ' -- GRAPHIC window with no text means no caption
          GRAPHIC WINDOW "", 0,0, dx, dy TO hWin
        
          ' -- Draw something to it
          GRAPHIC ATTACH hWin, 0
          GRAPHIC CLEAR %BLACK
          GRAPHIC BOX (10, 10) - (dx-10, dy-10), 0, RGB(0, 128, 0)
        
          ...
        PBWin/9 and PBCC/5 have GRAPHIC WINDOW CLICK to detect mouse clicks, in older releases it was possible to subclass the window, I think.

        You could also forget GRAPHIC, and in PBWin/7 just use GDI+, it is very powerful library. To create fullscreen window in PBWin/7 use:
        Code:
          ...
        
          ' -- We will retrieve desktop size
            DESKTOP GET CLIENT TO dx, dy
        
            '  Create a new dialog template
            DIALOG NEW PIXELS, 0, "Title of application",,, dx, dy, _
            %DS_NOFAILCREATE OR %DS_SETFONT OR %WS_CLIPSIBLINGS OR %WS_POPUP, _
            %WS_EX_TOPMOST OR %WS_EX_LEFT OR %WS_EX_LTRREADING TO hDlg
        ...
        But this works only when you don't have forced "Task bar" to be visible at all times.

        You could also create OpenGL/DirectX fullscreen window, which is a bit lower level, but allows rendering things really fast.
        [email protected]

        Comment


        • #5
          Thanks for all the input guys.

          Michael, will check out COM, I am using power point viewer rather than spending the money for powerpoint, but I will look and see if it show and see if there are docs for it.

          Petr, will test the code and thanks a lot. Hope it works.

          Comment


          • #6
            Well I thought I was ready to run. Here is what I have, but no graphic shows up. Tried render as well, with and without the bitmap load.

            Code:
            #COMPILE EXE
            #DIM NONE
            '#CONSOLE OFF
            
            FUNCTION PBMAIN () AS LONG
            
              LOCAL dx, dy AS LONG
              LOCAL hWin AS DWORD
            
              ' Turn on mouse events for later.
              MOUSE ON
            
              ' -- We will retrieve desktop size
              DESKTOP GET SIZE TO dx, dy
            
              ' -- GRAPHIC window with no text means no caption
              GRAPHIC WINDOW "", 0,0, dx, dy TO hWin
            
              ' -- Draw something to it
              GRAPHIC ATTACH hWin, 0
              GRAPHIC CLEAR %BLACK
            '  GRAPHIC BOX (10, 10) - (dx-10, dy-10), 0, RGB(0, 128, 0)
            
              nFile& = FREEFILE
              OPEN "c:\test.bmp" FOR BINARY AS nFile&
              GET #nFile&, 19, nW&
              GET #nFile&, 23, nH&
              CLOSE nFile&
              GRAPHIC BITMAP LOAD "c:\test.bmp",nW&,nH& TO hWin
              GRAPHIC ATTACH hWin, 0
            
            '  DO
            '      a$=INKEY$
            '      PRINT a$
            '  LOOP UNTIL LEN(a$)
              SLEEP 3000
            
            
            END FUNCTION

            Comment


            • #7
              Larry,
              change the lin GRAPHIC BITMAP LOAD
              to GRAPHIC RENDER "c:\test.bmp", (15,15)-(dx-15,dy-15)

              Paul.
              Code:
              #COMPILE EXE
              #DIM NONE
              
              FUNCTION PBMAIN () AS LONG
              
                LOCAL dx, dy AS LONG
                LOCAL hWin AS DWORD
              
                ' -- We will retrieve desktop size
                DESKTOP GET SIZE TO dx, dy
              
                ' -- GRAPHIC window with no text means no caption
                GRAPHIC WINDOW "", 0,0, dx, dy TO hWin
              
                ' -- Draw something to it
                GRAPHIC ATTACH hWin, 0
                GRAPHIC CLEAR %BLACK
                GRAPHIC BOX (10, 10) - (dx-10, dy-10), 0, RGB(0, 128, 0)
              
                GRAPHIC RENDER "c:\test.bmp", (15,15)-(dx-15,dy-15)
              
                SLEEP 3000
              
              END FUNCTION

              Comment


              • #8
                Hi Larry,

                I get just black screen for your version, Pauls one works 100%.

                The problem is your code creates graphic bitmap like generic buffer, not something which should be displayed immediately.

                Graphic render did not worked for you, because you called it before attaching control.

                So it is good to follow order:
                - create GRAPHIC window
                - attach
                - do drawing


                Petr
                [email protected]

                Comment


                • #9
                  Thanks for all the help. Examples were a little light for my brain.

                  Work great. Not to get the mouse click and position and I am good to go.

                  Thanks again.

                  Comment


                  • #10
                    to get the mouse click and position and I am good to go
                    Code:
                    #COMPILE EXE
                    #DIM NONE
                    FUNCTION PBMAIN () AS LONG
                    
                      LOCAL dx, dy AS LONG
                      LOCAL hWin AS DWORD
                    
                      ' -- We will retrieve desktop size
                      DESKTOP GET SIZE TO dx, dy
                    
                      ' -- GRAPHIC window with no text means no caption
                      GRAPHIC WINDOW "", 0,0, dx, dy TO hWin
                    
                      ' -- Draw something to it
                      GRAPHIC ATTACH hWin, 0
                      GRAPHIC CLEAR %BLACK
                      GRAPHIC BOX (10, 10) - (dx-10, dy-10), 0, RGB(0, 128, 0)
                    
                      GRAPHIC RENDER "c:\test.bmp", (15,15)-(dx-15,dy-15)
                    
                       t!=TIMER
                       DO
                        GRAPHIC WINDOW CLICK TO click&,x!,y!
                        IF click& THEN
                           GRAPHIC PRINT click&;x!; y!
                        END IF
                    
                        SLEEP 1
                        LOOP UNTIL (TIMER-t!) >10
                        
                    END FUNCTION

                    Comment


                    • #11
                      Paul, thanks for the help.

                      The code did not work for me. The graphic window "CLICK", seems like click is not a valid command in PBCC4.0, first time I have used it since I bought it.

                      My attempted code does not see the mouse either. Here is what I tried. Never see the mouse? But I was sort of confused by the mouse button command and maybe that is the problem?

                      Code:
                      #COMPILE EXE
                      #DIM NONE
                      '#CONSOLE OFF
                      
                      FUNCTION PBMAIN () AS LONG
                      
                        LOCAL dx, dy AS LONG
                        LOCAL hWin AS DWORD
                      
                        ' Turn on mouse events for later.
                        MOUSE 3, DOUBLE, DOWN
                        MOUSE ON
                      
                        ' -- We will retrieve desktop size
                        DESKTOP GET SIZE TO dx, dy
                      
                        ' -- GRAPHIC window with no text means no caption
                        GRAPHIC WINDOW "", 0,0, dx, dy TO hWin
                      
                        ' -- Draw something to it
                        GRAPHIC ATTACH hWin, 0
                        GRAPHIC CLEAR %BLACK
                      'the frame  GRAPHIC BOX (10, 10) - (dx-10, dy-10), 0, RGB(0, 128, 0)
                      
                        GRAPHIC RENDER "c:\test.bmp", (15,15)-(dx-15,dy-15)
                      
                      '  DO
                            DO
                            LOOP UNTIL MOUSESTAT
                            a$=INKEY$
                      '  LOOP UNTIL LEN(a$)=4
                        GRAPHIC BITMAP END
                        PRINT a$
                        SLEEP 5000
                      
                      
                      END FUNCTION

                      Comment


                      • #12
                        Larry,
                        detecting the mouse ina graphic window is a little more involved in PBCC4.
                        Check out these:



                        The MOUSE commands you're using refer to the console window, not the graphic window.

                        Paul.

                        Comment


                        • #13
                          Paul,

                          Thanks for the links, second one did the trick below is what I have so far, I will clean it up also redo the left/right code to locate the right graphic. Any idea how or where to find sample/info to turn off the status bar in the subclass. I do not want them to see it or be able to stop the program with the mouse, it is a touch screen and the wireless keyboard is hidden.

                          Thanks again for the direction. What I have so far from the links merged into the other code.

                          Code:
                          #COMPILE EXE
                          #DIM NONE
                          '#CONSOLE OFF
                          #INCLUDE "Win32Api.Inc"
                          '
                          GLOBAL GraphicWindowChildOldProc AS DWORD
                          GLOBAL hGraphicWindow AS DWORD
                          GLOBAL finished AS LONG
                          '
                          ' This is the function that is called whenever a Key or Mouse click is detected in the Graphics Window
                          FUNCTION GraphicWindowChildNewProc(BYVAL hWnd AS DWORD, BYVAL wMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG
                            GLOBAL dx, dy AS LONG
                            GLOBAL hWin AS DWORD
                            SELECT CASE wMsg
                               CASE %WM_NCHITTEST
                               CASE %WM_MOUSEMOVE
                               CASE %WM_LBUTTONDOWN
                                 ? "you clicked the left mouse button at ("+FORMAT$(LO(WORD, lParam))+","+FORMAT$(HI(WORD, lParam))+")"
                          
                          
                                 GRAPHIC RENDER "c:\test1.bmp", (15,15)-(dx-15,dy-15)
                                 GRAPHIC ATTACH hWin, 0&, REDRAW
                                 GRAPHIC REDRAW
                          
                          
                                 
                               CASE %WM_RBUTTONDOWN
                                ? "you clicked the right mouse button at ("+FORMAT$(LO(WORD, lParam))+","+FORMAT$(HI(WORD, lParam))+")"
                          
                          
                                 GRAPHIC RENDER "c:\test.bmp", (15,15)-(dx-15,dy-15)
                                 GRAPHIC ATTACH hWin, 0&, REDRAW
                                 GRAPHIC REDRAW
                          
                          
                               CASE %WM_KEYDOWN
                                 IF CHR$(WPARAM) = "X" THEN
                                   finished = 1
                                 ELSE
                                   ? "you pressed the "+CHR$(wparam)+ " key"
                                 END IF
                            END SELECT
                            '
                            FUNCTION = CallWindowProc(GraphicWindowChildOldProc, hWnd, wMsg, wParam, lParam)
                          END FUNCTION
                          '------------------------------ MAIN -----------------------------------
                          FUNCTION PBMAIN () AS LONG
                          'graphic
                            GLOBAL dx, dy AS LONG
                            GLOBAL hWin AS DWORD
                          'mouse
                            LOCAL w AS LONG
                            LOCAL tid AS LONG
                            ' -- We will retrieve desktop size
                            DESKTOP GET SIZE TO dx, dy
                          
                            ' -- GRAPHIC window with no text means no caption
                            GRAPHIC WINDOW "", 0,0, dx, dy TO hWin
                            '
                            finished = 0
                            '
                            GRAPHIC WINDOW "SubClass", 0, 0, dx, dy TO hWin
                            '
                            ' This function subclasses the Graphic Window
                            ' Which means that any key or mouse presses in the Window
                            ' Will cause the GraphicWindowChildNewProc Callback function to be called
                            GraphicWindowChildOldProc = SetWindowLong(hWin, %GWL_WNDPROC, CODEPTR(GraphicWindowChildNewProc))
                            '
                          
                          ' draw initial screen
                            GRAPHIC ATTACH hWin, 0
                            GRAPHIC CLEAR %BLACK
                          'the frame  GRAPHIC BOX (10, 10) - (dx-10, dy-10), 0, RGB(0, 128, 0)
                            GRAPHIC RENDER "c:\test.bmp", (15,15)-(dx-15,dy-15)
                            '
                            w = 0
                            ' loop until an X is pressed on the graphic window
                            WHILE finished = 0
                              INCR w
                              ' Every third iteration of the loop give back
                              ' one time slick to Windows too prevent 100% CPU utilization
                              ' See the SLEEP statement in the Help file
                              IF w MOD 3 = 0 THEN
                                SLEEP 0
                              END IF
                          
                          ' screen saver routine
                              IF LEFT$(TIME$,2) < "07" AND LEFT$(TIME$,2) > "19" THEN
                          ' line counter for screen saver mode
                                  INCR c%
                                  IF c%=10 THEN c%=0
                          
                                 GRAPHIC ATTACH hWin, 0&, REDRAW
                                 GRAPHIC CLEAR %BLACK
                                 GRAPHIC COLOR %BLUE, %YELLOW
                                 GRAPHIC FONT "Times New Roman", 48, 1
                                 FOR i% = 1 TO c%+1
                                     GRAPHIC PRINT ""
                                 NEXT i%
                                 GRAPHIC PRINT "              Touch the screen for directory              "
                                 GRAPHIC REDRAW
                                 SLEEP 3000
                              END IF
                          
                            WEND
                            '
                            ' Stop the timer from running
                            TimeKillEvent(tid)
                            '
                            ' Set the graphics window to use the original Callback routine
                            SetWindowLong(hGraphicWindow, %GWL_WNDPROC, GraphicWindowChildOldProc)
                          
                          END FUNCTION

                          Comment


                          • #14
                            Larry,
                            as you said in an earlier post:
                            ' -- GRAPHIC window with no text means no caption
                            GRAPHIC WINDOW "", 0,0, dx, dy TO hWin
                            Just replace "Subclass" with "" when you create the window.

                            Paul.

                            Comment

                            Working...
                            X