.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Shortcut - Icon Image Does Not Appear

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
rpearsall
1250 Views, 2 Replies

Create Shortcut - Icon Image Does Not Appear

My Visual Studio 2010 VB.NET program creates a shortcut to an ACAD.EXE file.  I want to use the out-of-the-box AutoCAD icon image.  The default path to the icon image is:

 

%SystemRoot%\Installer\{GUID}\ACA2013.ico

 

I use the following methodology:

 

Dim objShellClass As New IWshRuntimeLibrary.IWshShell_Class Dim objShortcut As IWshRuntimeLibrary.IWshShortcut

 

objShortcut = CType(objShellClass.CreateShortcut(strPathFile), IWshRuntimeLibrary.IWshShortcut)

 

With objShortcut

       .Arguments = strArguments

       .Description = strName

       .IconLocation = strIconLocation

       .TargetPath = strTargetPath

       .WindowStyle = IWshRuntimeLibrary.WshWindowStyle.WshNormalFocus

       .WorkingDirectory = strWorkingDirectory

       .Save()

End With

 

Everything works fine except the shortcut image is blank.  When I right-click on it and select properties, then Change Icon... it is pointing to the correct icon image.  If I select OK and OK the icon image appears on the shortcut.

 

Why does the image NOT appear when the shortcut is initially created?

 

Thanks,

 

Randy

2 REPLIES 2
Message 2 of 3

What happens if you don't specify an Icon ?

Message 3 of 3
rpearsall
in reply to: rpearsall

Thank you for the reply. You indirectly helped me solve my own stupid problem... an oversight on icon indexing. What you suggested works in the simplest sense because it uses the icon image in the EXE file in the Target path. But, here is the unique problem... Autodesk uses the same EXE file for both AutoCAD and AutoCAD Architecture in 2013, but the icon images are different. The images are not stored in the EXE file. Only one is. They just point to different GUID installer icon files (which is why the path to the icon file is different for each program) AutoCAD %SystemRoot%\Installer\{5783F2D7-B001-0409-2102-0060B0CE6BBA}\Acad162_icon.exe AutoCAD Architecture %SystemRoot%\Installer\{5783F2D7-B004-0409-2102-0060B0CE6BBA}\ACA2013.ico My mistake was this... strIconLocation = "%SystemRoot%\Installer\{5783F2D7-B001-0409-2102-0060B0CE6BBA}\Acad162_icon.exe, 1" strIconLocation = "%SystemRoot%\Installer\{5783F2D7-B001-0409-2102-0060B0CE6BBA}\ACA2013.ico, 1" I was calling for INDEX = 1 of the images in the file, but there is only one image in the file which means INDEX = 0 ...or more simply as you suggested...just omit it all together. Thanks, Randall A. Pearsall Application Engineer Interoperability Specialist VB.NET | ASP.NET | JavaScript | VBA | AutoLISP Revit | AutoCAD | Excel | Word | SQL Server [Revit_Architecture_2013_Certified_Professional_BLK25] NELSON Focused on Creation, Passion to Deliver The NELSON Regional Operating Company, LLC Two Midtown Plaza | 1349 West Peachtree Street | Suite 1300 | Atlanta, GA 30309 tel 404.873.3697 x226 | cell 404.219.6216 | fax 678.904.1510 | e rpearsall@nelsononline.com NELSONonline.cominterior design | architecture | engineering | strategies | information services | workplace services -------------------------------------------- This email transmission and any associated attachments may contain information that is privileged or confidential. If you are not the intended recipient and you received this transmission in error, please delete it and notify the sender immediately. Thank you for your compliance. ARCHITECTURAL, ENGINEERING AND INTERIOR DESIGN SERVICES OFFERED BY LICENSED AFFILIATES.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost