How to wrap text in icon description on desktop in windows

I'm trying to figure out how to wrap the text / title of our icon on the desktop.  Seems like there's no way to make sure your text is wrapped at a certain point.  I know you can add spaces, and change the font size, but we want it so anytime anyone installs it, it will wrap at the appropriate point.  This is NOT the IconTitleWrap key: HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics.  This is just for our icon.  
LVL 16
Bryan ButlerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I'm pretty certain this will not be possible.

Even if you managed to have your installer insert a carriage return (0x0d) into the link's name, Windows will not accept it as this is a disallowed character for file names. And even if you managed to still create such a link by some means of a trick, you would end up with a .lnk file that is most likely unclickable and most certainly undeletable by your customer - which cannot be what you want.

The only way I see how you could achieve this is to leave a blank space at the spot where you want the wrap to take place, and to omit blank spaces otherwise. This will make sure the icon text wraps at the same point on any system your application is installed to.

Have you already looked into rephrasing the icon text into something that is more likely to wrap in a convenient way?
That was exactly what I was going to say earlier when I saw the question, but was tied up with something else.  What I would add is that even if the spacing of the file name (ie. the icon text) is arranged so that it wraps, the user settings cannot be reasonably anticipated to always be standard, if there is such a word in computing.  For example a user may have set the desktop to display larger icons, or larger font for the icon text, and a number of other desktop settings that could change and make it look stupid.

HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics
there are other values such as the following to be considered as potential spanners in the works:
IconFont, IconSpacing, IconVerticalspacing, and possibly others.
Some weird Themes may also play havoc with your proposal.

You can retrieve the actual pixel values of these settings using the VBScript in the code snippet.  Paste into Notepad and Save As something like "GetIconMetrics.vbs".  Just run it using the command:
CScript //NoLogo GetIconMetrics.vbs

I personally would not appreciate an installer routine trying to force an appearance setting on my registry for the sake of wrapping the icon text of its own desktop icon.
On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_Desktop", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
    WScript.Echo "GridGranularity: " & objItem.GridGranularity
    WScript.Echo "IconSpacing: " & objItem.IconSpacing
    WScript.Echo "IconTitleFaceName: " & objItem.IconTitleFaceName
    WScript.Echo "IconTitleSize: " & objItem.IconTitleSize
    WScript.Echo "IconTitleWrap: " & objItem.IconTitleWrap

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Agree with torimar and Bill here ... even programmatically getting the icon text to wrap in the exact desired spot under one configuration cannot be guaranteed under another, since the resultant "grid" that icon widths inherit is a function of the icon font, spacing, DPI, and if text wrapping is enabled at all (IconTitleWrap).

This all seems like a lot of work for a single desktop icon. I'm with torimar ... shorten it or rename it so you can workaround this issue.

Good luck!
Bryan ButlerAuthor Commented:
It was worth asking.  Many have tried, none have succeeded.  I agree about registry.  And thanks for all the info.  I have looked at rephrasing and spacing as it looks like the only option.  I have see icons where it looks like they managed to do this somehow.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.