Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Jul : How to determine the dimensions of an HICON?

www.cryer.info
Managed Newsgroup Archive

How to determine the dimensions of an HICON?

Subject:How to determine the dimensions of an HICON?
Posted by:"Ian Boyd" (ian.borlandnews0..@avatopia.com)
Date:Thu, 24 Jul 2008 16:08:47 -0400

i want to draw an icon using:

    DrawIcon(dc, hIcon);

but i first need to know how big the icon (dimensions, not bytes) is.

i looked at GetIconInfo(), but that only gives me the location of the
hot-spot, the color, and the mask.

Really, i'm trying to write the function:

    function CreateBitmapFromIcon(const icon: HICON): HBITMAP;
    begin
        //Step 2: ???
    end;

i was going to create a 32bpp bitmap, select it into a memdc, use DrawIcon
to do the drawing (with alpha transparency support).

But i'm stuck at step 1: Create a bitmap.

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive