Announcement

Collapse
No announcement yet.

DDT dialog with bitmap

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

  • DDT dialog with bitmap

    Does anyone out there in "code land" have an example in their "toolbox" of painting the client area of a ddt window with a bitmap from a resource file? I have been playing around with Setclasslong and the %GWL_HBRBACKGROUND(from a non-ddt code example) but so far I haven't had much luck? I am beginning to wonder if you can use these two in conjunction with ddt windows.
    Either that, or I don't know what I am doing(whick wouldn't be a first).

    Regards,
    Adam

  • #2
    no problem, i will dig some up for you. if you have any labels
    without frames, you will have to paint it's background with a
    transparent brush, otherwise it looks kind of goofy.

    lance and dave posted awhile back some splash screen demo's in
    the ftp site. that will get your bitmap nicely into your
    dialog box. scott has one for ddt.

    links


    http://www.powerbasic.com/files/pub/...ics/splash.zip


    if your dialog is resizable, you will need to trap the "paint background" message and replace it with your own repaint.

    i have a really nice example in c i can send to you too! it would
    not be difficult to port over.

    regards, jules

    [this message has been edited by jules marchildon (edited february 18, 2000).]
    Best regards
    Jules
    www.rpmarchildon.com

    Comment


    • #3
      Thank ya' ever so much sir. It's amazing the programming experience surging through the veins of these forums. I have to go and hook up the huskies to the dog sled now so I can get through all this new snow we have gotten today(Ahhhhhh - Michigan; buried in snow one day - it all melts away the next)

      mush,mush....

      Regards,
      Adam


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

      Comment


      • #4
        Also note that PB/DLL 6.0 comes with SMTP.BAS (in SAMPLES\TCP} which is an example of displaying a bmp in the client area of a DDT dialog. The code loads the file from disk, but conversion to use a resourcefile is minor.



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

        Comment


        • #5
          Right underneath my nose, that figures. That was one example I never bother to look at. I will check it out.

          Thank ya' sir,
          Adam


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

          Comment


          • #6
            You will have to forgive my stupidity Lance, but what would that minor conversion be?(and I thought I could handle it myself, ha)

            Adam


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

            Comment


            • #7
              Place the image into the resource file and change the LoadImage() line to get the image from there instead of a disk file:

              Orig:
              hBmp = LoadImage(BYVAL %NULL, bmpfile, %IMAGE_BITMAP, x, y, %LR_LOADFROMFILE)

              New (will need to be adapted to your usage therefore this is not tested) :
              hBmp = LoadImage(GetModuleHandle(""), %idbmpfile, %IMAGE_BITMAP, x, y, %LR_DEFAULTSIZE)



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

              Comment


              • #8
                I'm a bit confused by the fact that "SMTP.bmp" appears no where,
                and indirection, such as "REPLACE ".EXE" WITH ".BMP" IN bmpfile"
                does not help.

                Does anyone have a less confusing example of getting a screen-shot.bmp
                compiled into a program?

                With GRAPHIC WINDOW, GRAPHIC ATTACH, and GRAPHIC RENDER, I was able
                to display several views from disc files, but I want to get all files
                into one *.exe.

                Yep, another GUI newbie is on a steep learning curve.

                ------------------
                [email protected]
                http://powerbasic.thimk.biz/
                Don M. / aka thimk at thimk dot biz

                http://powerbasic.thimk.biz/

                Comment


                • #9
                  SMTP.BMP is inside of \SAMPLES\INTERNET\SMTP...

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

                  However, the GRAPHIC control provides much more ease of use in creating a bitmap "viewport" of sorts on a dialog...


                  [This message has been edited by Adam J. Drake (edited July 07, 2005).]
                  Adam Drake
                  Drake Software

                  Comment


                  • #10
                    Adam, I'm not quite tracking.

                    RE SMTP.BMP, I knew where it was on disk, but not in the code.

                    RE GRAPHIC control: I said that I had been able to display *.bmp
                    files from disk, using GRAPHIC, but I want to end up with only
                    one file to distribute, not five.

                    From 1999 to 2005, there are numerous posts on bitmaps and resource
                    files, but I see none that take advantage of latest compiler version.
                    I want some kind person[s] to specifically explain getting *.bmp
                    files into resource file / exe file, with only finite [smile ]
                    learning on my part. I now have PBWin-8 and PBForms 1.51.

                    ------------------
                    [email protected] http://powerbasic.thimk.biz/

                    [This message has been edited by Donald Miller (edited July 07, 2005).]
                    Don M. / aka thimk at thimk dot biz

                    http://powerbasic.thimk.biz/

                    Comment


                    • #11
                      To place a bitmap in resource file:

                      Code:
                      LOGO BITMAP LOGO.BMP
                      MYPIC BITMAP SOMEPIC.BMP
                      The bitmaps files obviously must exist and be in proper folder when .RC is compiled into .PBR.

                      Code:
                      #RESOURCE "myapp.pbr"
                      CONTROL ADD GRAPHIC, main_dwHandle, %cnvMyCanvas, "", 0, 0, 200, 200
                      CONTROL HANDLE main_dwHandle, %cnvMyCanvas, TO main_dwGraphicHandle
                      
                      GRAPHIC ATTACH main_dwGraphicHandle, 0
                      
                      GRAPHIC RENDER "LOGO", (0, 0) - (99, 99)
                      GRAPHIC RENDER "MYPIC", (100, 000) - (199, 199)
                      ... repeat for however many bitmaps appear
                      Note that if you plan to resize images, or do anything else where the graphic control size varies,
                      the graphic control must be killed and added again.

                      Ron Z


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


                      [This message has been edited by Ron Zutz (edited July 08, 2005).]

                      Comment


                      • #12
                        Sorry, misunderstood exactly what you were asking...What Ron said about resource files...

                        In regard to SMTP.BMP, here's how the filename is being derived:

                        Code:
                            LOCAL  bmpfile AS ASCIIZ * %MAX_PATH 
                        
                        ' down to line 287...
                           
                                GetModuleFilename %NULL, bmpfile, SIZEOF(bmpfile)
                                bmpfile = UCASE$(bmpfile)
                                REPLACE ".EXE" WITH ".BMP" IN bmpfile
                        ------------------


                        [This message has been edited by Adam J. Drake (edited July 08, 2005).]
                        Adam Drake
                        Drake Software

                        Comment

                        Working...
                        X