grantman16 Posted February 14, 2010 Posted February 14, 2010 I need a way to extract an 8-bit icon from a file, specifically an exe. I've tried using ExtractAssociatedIcon, but that only extracts 32-bit icons, and I have not found a way to convert it to 8-bit. Thanks! grantman16 Quote
Administrators PlausiblyDamp Posted February 14, 2010 Administrators Posted February 14, 2010 You might have better luck with the ExtractIconEx API - http://www.pinvoke.net/default.aspx/shell32.ExtractIconEx contains the declares and a sample bit of code for using it. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
grantman16 Posted February 15, 2010 Author Posted February 15, 2010 Hey, Thanks for your help, but I ended up setting the background image of the form to a screenshot of the screen behind it and laying the icon on top of that, creating the illusion that the alpha regions are overlaying the screen behind it. It works flawlessly for the application I'm developing. In case you're wondering, here's the code I used: Me.Visible = False Dim bounds As Rectangle = Me.Bounds ' Form border should be set to None Dim screenshot As New Bitmap(bounds.Width, bounds.Height, Imaging.PixelFormat.Format32bppArgb) Dim g As Graphics = Graphics.FromImage(screenshot) g.CopyFromScreen(bounds.Location, New Point(0, 0), bounds.Size, CopyPixelOperation.SourceCopy) Me.BackgroundImage = screenshot Me.Visible = True - grantman16 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.