Print Page | Close Window

Icon from an Executable

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=12447
Printed Date: 07 October 2024 at 10:19am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Icon from an Executable
Posted By: Boris
Subject: Icon from an Executable
Date Posted: 15 October 2008 at 2:06pm
Using VB2005
Hi,
 
This works

Dim ic As Icon

ic = Icon.ExtractAssociatedIcon("C:\Program Files\RealVNC\VNC4\vncviewer.exe")

ImageManager1.Icons.AddIcon(ic.Handle, ID_CONNECT_VNC, XtremeCommandBars.XTPImageState.xtpImageNormal)

This doesn't ... it produces a horrible black border around the icon
ic = Icon.ExtractAssociatedIcon("C:\Windows\system32\mstsc.exe")

ImageManager1.Icons.AddIcon(ic.Handle, ID_CONNECT_RDC, XtremeCommandBars.XTPImageState.xtpImageNormal)

CommandBars.Icons.AddIcon(ic.Handle, ID_CONNECT_RDC, XtremeCommandBars.XTPImageState.xtpImageNormal)

Can anyone tell me what I am doing wrong ??

Regards to all



-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013



Replies:
Posted By: Oleg
Date Posted: 16 October 2008 at 4:34am
Hi,
 
Guess it extracts Alpha icon. You need enable ComCtrl v6.0 to allow use it.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Boris
Date Posted: 16 October 2008 at 8:47am
Hi Oleg,
 
Thanks for your reply... not sure what you mean. I am working with VB.net  2005 and V12 of Xtreme Suite. I cannot seem to find anywhere that mentions ComCtl... have you got a snippet to show me what you mean.
Regards,


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013


Posted By: Oleg
Date Posted: 16 October 2008 at 3:35pm

Hi,

 
Add bolded lines to your Main method:
 

Shared Sub Main()

Application.EnableVisualStyles()

Application.DoEvents()

...
frmMain.Instance = New frmMain
Application
.Run(frmMain.Instance)

End Sub



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Boris
Date Posted: 03 November 2008 at 3:49am

Hi Oleg. Thanks for your reply. Your suggestion wouldn't work for me. I have since found out that the Icon class in VB.net does not support the alpha colours. I did find though that converting to a bitmap somehow works.

Dim bmp As Bitmap

bmp = Icon.ExtractAssociatedIcon(
"C:\Windows\system32\mstsc.exe").ToBitmap

bmp.Save(GetAppPath() & "mstsc.bmp")

ImageManager1.Icons.LoadBitmap(GetAppPath() & "mstsc.bmp", ID_CONNECT_RDC, XtremeCommandBars.XTPImageState.xtpImageNormal)

What I haven't been able to do is to capture the image without saving it first so alhough not perfect it works. It would be nice if you were to include an extract icon method that worked in your next release seeing as VB.Net doesn't support it.

Regards


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013


Posted By: Oleg
Date Posted: 03 November 2008 at 8:26am
Hello,
 
for next version added LoadIconfromResource for this case.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Boris
Date Posted: 03 November 2008 at 8:29am
Hi
 
That's really great. Thanks Oleg.
 
Regards


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net