Announcement

Collapse
No announcement yet.

Adding bitmaps as a resource

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

  • Adding bitmaps as a resource

    It is quite a few years since I've needed to add a resource (PBR) file to a programme and I've just spent some time attempting to do so without success.
    I've looked through the forum and it seems my old method is quite out of date on PB10 on Windows 10 and me with it.
    Apparently there's a new way of doing this but I can't find any info.
    Could someone bring me up to date with adding one icon and two bitmaps as Resources?
    Brian.

  • #2
    Howdy, Brian!

    The #Resource statement is your friend.

    Code:
    #Resource Bitmap logoA, "_icons\ezreaderb.bmp"
    #Resource Bitmap logoB, "_icons\ezreaderb.bmp"
    #Resource Icon bigpads, "_icons\bigball.ico"

    Comment


    • #3
      And, Brian,
      Once you have the images as resources, there are a variety of ways to access them. Help gives the ways, but feel free to post additional questions on accessing the resources.

      Comment


      • #4
        Howdy, Brian,
        Graphic Render, Graphic Bitmap Load and Graphic ImageList are the basic commands for using resource images.

        Comment


        • #5
          To add to Gary's post:

          Once the #RESOURCE statement is there:

          DIALOG SET ICON hdlgMain,"logoA"
          ...

          GRAPHIC BITMAP LOAD "logoB", 100, 100 TO hBmp

          etc...

          IOW, you can use the resource ID the same way as you would use a filename for an external image.

          Edit: To add to his first post, he added a couple of others while I was composing

          Comment


          • #6
            Thank you Gary and Stuart. It may surprise you that I actually got it to work and it is really simple.
            Again, Thanks for your trouble.
            BTW I notice that you get up very early.
            Brian.

            Comment


            • #7
              Originally posted by Brian Reynolds View Post
              Thank you Gary and Stuart. It may surprise you that I actually got it to work and it is really simple.
              Again, Thanks for your trouble.
              BTW I notice that you get up very early.
              Yep, it really is simple to use many types of resource now with PowerBASIC.
              It's worth taking a look at RCDATA and Resource$(). You may like to check out
              https://forum.powerbasic.com/forum/u...nd-loadlibrary

              Its currently 7:00 pm on Saturday evening here in tropical Port Moresby

              Comment


              • #8


                > Its currently 7:00 pm on Saturday evening here in tropical Port Moresby

                Does that mean a couple of cold beers are on the menu ?
                hutch at movsd dot com
                The MASM Forum

                www.masm32.com

                Comment


                • #9
                  I should have mentioned that initially Gary's code caused an error and after examining my own code, I found the error was caused by:
                  Code:
                  #Resource Bitmap logoA, "_icons\ezreaderb.bmp"
                  should have read:
                  Code:
                  #Resource Bitmap logoA, ".icons\ezreaderb.bmp"
                  Again, thank you for your trouble.
                  BTW Stuart, I am just acrodd the water and a few hundred km inland at Longreach, Qld.
                  Brian.

                  Comment

                  Working...
                  X