Announcement

Collapse
No announcement yet.

Embedding BMPs, etc on your code

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

  • Embedding BMPs, etc on your code

    Is there any way that I can embed BMPs when compiling my code using PBDLL 6.0?
    I'd like to have just an EXE.

    thank you.

  • #2
    Yes, easy...
    Make a resource file (program.rc for example)

    #include "resource.h" 'gotta have that
    #define SPLASH 1030
    SPLASH BITMAP SPLASH.BMP

    This is a batch file I use for compiling the resource file, you will have to move RC.EXE and PBRES.EXE into your path however:

    'Makerc.bat
    @if exist %1.pbr del %1.pbr
    @rc %1
    @if exist %1.RES pbres %1


    Now to your code, in the .bas:

    $resource PROGRAM.PBR


    Now your bitmap is embedded in your .EXE file, This is my splash screen procedure, which you now have all of the code to:
    Notice how the bitmap is displayed "#1030"...Read the help file for more exhaustive explanation...

    Code:
    Global sDlg as long
    %IDT_TIMER1 = %WM_USER + 901
    
    Function SplashProc() As Long
      Dialog New 0, "",,, 305,158, %WS_POPUP Or %WS_DLGFRAME  To sDlg
      Control Add Image, sDlg, -1,"#1030",1,1,305,158
      Dialog Show Modal sDlg Call SplashScreen
    End Function
    
    '------------------------------------------------------------------------------
    Function Pbmain() as long
    
    SplashScreen
    End function
    
    
    CallBack Function SplashScreen() As Long
      Local hInst  As Long
      Local wMsg   As Long
      Local wParam As Long
      Local lParam As Long
    
      wMsg = CbMsg
      lParam = CbLparam
      wparam = CbWparam
      hInst = hInstance
    '  MousePtr 11 'BUSY
    
      Select Case wMsg
    
        Case %WM_INITDIALOG
              SetTimer  sDlg, %IDT_TIMER1,  3500, ByVal %NULL
            Function =  0
            Exit Function
    
        Case %WM_DESTROY
             KillTimer sDlg,  %IDT_TIMER1
    
        Case %WM_TIMER
            Select Case CbWparam
              Case %IDT_TIMER1
                 MousePtr 0
                 Dialog End sDlg, 1
            End Select
    
      End Select
     End Function
    '-----------------------------------------------------------------------------------



    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      PS Ivan...

      PB will want you to register with your full name, just a heads up....



      Scott

      ------------------
      Scott
      mailto:[email protected][email protected]</A>
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        Ivan,

        (The use of your full name is requested on this forum)

        You can easily embed a bitmap within your EXE using a resource file.
        To do this, create a rc file holding something like this:
        Code:
        PROGRAM ICON   BOU32.ICO
        LOCK    BITMAP LOCK.BMP
        DIAPO   BITMAP BOUDIAP.BMP
        CRAN    BITMAP CRAN.BMP
        Then use the RC.EXE and PBRES.EXE utilities to transform it to a .PBR file, then finaly including in your main EXE source code like this:

        #RESOURCE "MYRES.PBR"

        Last suggestion, take a look at the PB/DLL documentation.




        ------------------
        Patrice Terrier
        mailto[email protected][email protected]</A>
        Patrice Terrier
        www.zapsolution.com
        www.objreader.com
        Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

        Comment


        • #5
          Ivan, the rules of this BBS require that you register with your full name (first + last)... alias's and handles are not permitted.

          Please reregister correctly before posting future messages.

          Thanks!


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

          Comment

          Working...
          X