CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2010
    Posts
    23

    Unhappy Using bitmaps as a resource

    am using Visual C++ and win32. The program is C++ and does not use the forms.

    I created "pictures.RESX" file using the Resourcer program. The namespace name is instruction.resource

    This created a file which contains all my bitmap files.

    I have also managed to include this into my program using the resource facility in Visual C++ . I can view the bitmap files using the resource viewer.

    What I am trying to do at the moment is access these bitmap files in the program. I have created a toolbar which I have used standard buttons and bitmaps. I now want to use my own bitmaps for the buttons.

    I saw an example where I was told to define the bitmaps as:-

    #define IDB_Btn0 3000

    TBBUTTON tbb[3];
    TBADDBITMAP tbab;

    tbab.hInst = HINST_COMMCTRL;
    tbab.nID = IDB_STD_SMALL_COLOR;

    ZeroMemory(tbb, sizeof(tbb));
    //********** NEW FILE BUTTON
    tbb[0].iBitmap = IDB_Btn0 ;
    tbb[0].fsState = TBSTATE_ENABLED;
    tbb[0].fsStyle = TBSTYLE_BUTTON;
    tbb[0].idCommand = MNU_INSERT_CONTACTS;


    This is the code I am using what I am not sure of is do I need to address the bitmap files as part of the resource file "pictures.RESX" . This is being compiled into the Exe file.

    I have been told that the tbab.nID is wrong and that tabb[0] should refere to an index of the bitmaps. How should I correct this. Do I need to define the resource filename in the program or will the names in the resource file be available (Btmp0.bmp,Btmp1.bmp,Btmp2.bmp etc)

    Thanks

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: Using bitmaps as a resource

    Quote Originally Posted by rbettes View Post
    am using Visual C++ and win32. The program is C++ and does not use the forms.
    So it is no C++/CLI program. I have seen you already have a thread on that topic over there in the Visual C++ forum (and got an answer there). This is the right place for the thread, so why don't you continue there?

  3. #3
    Join Date
    Aug 2010
    Posts
    23

    Re: Using bitmaps as a resource

    Ok I did post it there but I haven't got a answer yet with regard to new question

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured