ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Load HICON into ImageEn
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Andy_Bell

United Kingdom
37 Posts

Posted - Aug 27 2020 :  18:17:03  Show Profile  Reply
Hi

I'm using the Windows function ExtractIcon(...) to return a HICON handle to an executable file's first Icon resource.

Currently, I'm having to load it into a TImage using its Picture->Icon->Handle property and then save it to a temp file before loading into ImageEn.

It seems convoluted but I looked at TIEResourceExtractor and that seemed far more complex than I needed. I was also unable to figure out a way to reliably get the same icon that ExtractIcon was returning.

Questions:

Can I load the Icon returned by ExtractIcon into ImageEn - that is just from the Icon Handle?

Is there a simple way to use TIEResourceExtractor to do this?

Andy

Andy

xequte

38615 Posts

Posted - Aug 27 2020 :  19:33:49  Show Profile  Reply
Hi Andy

The method is not documented, but you can just use IEConvertIconToBitmap in the bmpfilt unit.

procedure IEConvertIconToBitmap(icon: HICON; DestBitmap: TIEBitmap; InvalidJumboIconAction : TInvalidJumboIconAction = ijiaIgnore);

e.g.
IEConvertIconToBitmap( hicon, ImageEnView1.IEBitmap );
ImageEnView1.Update();


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Andy_Bell

United Kingdom
37 Posts

Posted - Aug 28 2020 :  03:37:01  Show Profile  Reply
Thanks

I get link errors with that function:

Error: Unresolved external '__fastcall Bmpfilt::IEConvertIconToBitmap(void *,Iexbitmaps::TIEBitmap *,Bmpfilt::TInvalidJumboIconAction)' referenced from 'ExternalEditors.obj'

Even if I include bmpfilt.pas in my project, I still get the error. C++ Builder 2007

The function is not in Image En Library file - I'm statically linking... If I include bmpfilt.pas in my project, bmpfilt.obj contains no accessible methods... Weird. My Delphi is not good enough to fix this, I'm afraid.

Is there a define I need to make to get the function included?

ADD: I can create a delphi project in RAD Studio 2007 and call the function ok. But not in Builder.

Andy
Go to Top of Page

xequte

38615 Posts

Posted - Aug 30 2020 :  22:57:57  Show Profile  Reply
Hi Andy

Well the other option is to get a TIcon object from the hicon value (lots of code on the web for this).

You can then call:

ImageEnView1.Assign( myIcon );

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: