Posts: 14
Registered: ‎05-16-2012
Message 1 of 3 (513 Views)
Accepted Solution

Create Shortcut - Icon Image Does Not Appear

513 Views, 2 Replies
01-19-2013 01:46 PM

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:




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


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?





Valued Mentor
Posts: 370
Registered: ‎05-06-2012
Message 2 of 3 (501 Views)

Re: Create Shortcut - Icon Image Does Not Appear

01-20-2013 01:13 AM in reply to: rpearsall

What happens if you don't specify an Icon ?

Posts: 14
Registered: ‎05-16-2012
Message 3 of 3 (478 Views)

Re: Create Shortcut - Icon Image Does Not Appear

01-21-2013 02:45 PM 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.
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.