CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    81

    Resources For Release Version

    I have a bunch of bitmaps/icons I use in the release version of a program. I was hoping to incorporate them in the executable file so I don't have to add a list image files along with the executable.

    Many of them are loaded using LoadImage. Can I do it so they are lumped into the executable?

    Thanks,

    Matt

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Resources For Release Version

    Originally posted by hatflyer
    Many of them are loaded using LoadImage. Can I do it so they are lumped into the executable?
    Just add them as bitmap and icon resources. As for LoadImage(), when you omit the LR_LOADFROMFILE flag, the lpszName will be treated as the resource identifier instead of the filename (actually, that's the default behaviour of LoadImage).

  3. #3
    Join Date
    Jan 2004
    Posts
    81
    I'm still confused. I did add them as resources, and here is the code I had been using for one of the icons:

    HICON hIcon = (HICON) ::LoadImage(NULL,"res\\ok.ico",IMAGE_ICON,50,24,LR_LOADFROMFILE);

    Was format should I use so that I don't have to physically include the ok.icon resource when I give a copy of my executable to someone else?

    Thanks

  4. #4
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    Are you sure you know what a resource is? The code you posted still reads from a file, as it still uses the LR_LOADFROMFILE flag and a file name as the second parameter. To include your icons and bitmaps as resources in your executable, add them to your project's resources using the resource editor. Then you will be able to load them via LoadImage() by specifying the resource identifier (instead of the file name).

  5. #5
    Join Date
    Jan 2004
    Posts
    81
    ALl the icons and bitmaps were created in the resource editor of the project. They all have an ID (the one I mentioned loaded from a file has the ID of IDI_RESET).

    The parameters for the function LoadImage are confusing. If I don't use the LoadFromFile flag, which do I use? And what is the format of the icon/bitmap identifier? A handle? Is NULL used as the first parameter?

    As you can tell, I'm a newbie.

  6. #6
    Join Date
    Jun 2003
    Posts
    58
    LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RESET),...,...,...,...);

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