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

    Change Size of Standard Icon

    I'd like to load a standard icon in my application, such as IDI_QUESTION. Using LoadIcon, this works fine, but the icon loaded is 32x32, whereas I'd like 16x16.

    I've tried the following code to load the icon using LoadImage, but nothing is shown.

    Code:
    HICON hIcon = ( HICON ) LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDI_QUESTION ), IMAGE_ICON, 16, 16, 0 );
    So, how can I change the size of a windows standard icon?

  2. #2
    Join Date
    Dec 2008
    Posts
    29

    Re: Change Size of Standard Icon

    For default system icons do not use MAKEINTRESOURCE or AfxGetInstanceHandle.
    First parameter must be NULL and directly use IDI_QUESTION.

    try this code:
    Code:
     LoadImage(NULL, IDI_QUESTION, IMAGE_ICON, 
                       16, 16,  LR_DEFAULTCOLOR);
    Last edited by codecX; January 9th, 2009 at 06:48 AM.

  3. #3
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Change Size of Standard Icon

    I don't know what your intent is once you load the icon, but, you can use DrawIconEx () to render it compressed.
    Gort...Klaatu, Barada Nikto!

Tags for this Thread

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