?
Solved

How to Add Desktop shortcut Icon

Posted on 2001-08-08
14
Medium Priority
?
596 Views
Last Modified: 2013-11-20
How do i Add Desktop shortcut Icon to my application?

Secondly, how do i add a program folder and shortcut in the Start Menu?

Thanks.





0
Comment
Question by:nitshv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +6
14 Comments
 

Expert Comment

by:noushadxp
ID: 6366872


hellow nitshv


        do the following
       


        1 right click the mouse
        2 select new ->shortcut->enter
        3 a window is displayed;enter path in the dis- layed window,if you know,else select brouse and find outthe
file

         4 then just click 'next' then 'finish'.

     prety ! you have created a shortcut
0
 
LVL 1

Expert Comment

by:kkarunakar
ID: 6366927
Hi,
If you want to create shortcut not by programming.Follow these steps.
CREATING A SHORTCUT TO A PROGRAM OR FILE

To create a shortcut on the desktop to a program or file, follow these steps:


Right-click an open area on the desktop, point to New, and then click Shortcut.

Click Browse.

Locate the program or file to which you want to create a shortcut, click the program or file, click Open, and then click Next.

Type a name for the shortcut. If a Finish button appears at the bottom of the dialog box, click it. If a Next button appears at the bottom of the dialog box, click it, click the icon you want to use for the shortcut, and then click Finish.

If you want to do it doing MFC programming there is another way.
Thanks
Keshav
0
 
LVL 1

Expert Comment

by:kkarunakar
ID: 6366933
Hi
If you want to create shortcut using programming in MFC.There is many article in MSDN. You can refer to IShelllink interface. Or even find "Create Shortcut" in search. You will get information.
SHORTCUT: A SampleThat Manipulates Shortcuts
This article gives one example to show that.
I hope this will help you.
Thanks
keshav
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 49

Expert Comment

by:DanRollins
ID: 6367116
If you use InstallShield (free with VC++) you can easily create start-menu group and desktop icon.  Just ask.

--- Dan
0
 

Author Comment

by:nitshv
ID: 6367393
First of all this question is posted in MFC section so obviously i'm not talking abt right cliking and making a shortcut.

Dan, I would like to do all the stuff on my own and not use InstallShield for the installation part.So help...

btw, I'm through with the desktop icon part, I was able to code that. I need to know how to add the start menu group?

thanks.

0
 

Expert Comment

by:orenlev
ID: 6370276
Well, if you did the desktop part, then doing the start menu part is just as easy.
It's just another folder in the system.

You can use:

HRESULT SHGetFolderPath(HWND hwndOwner,
                        int nFolder,
                        HANDLE hToken,
                        DWORD dwFlags,
                        LPTSTR pszPath);

where:
nFolder = CSIDL_STARTMENU

Oren
0
 

Author Comment

by:nitshv
ID: 6373298
but How do i add a new folder in the start menu?
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6376170
> but How do i add a new folder in the start menu?

use mkdir (make directory) or CreateDirectory(Ex)- the start menu is nothing more than the directory structure converted into a menu
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6376537
Putting something in the StartMenu folder itself is not 2 kuel.  You should put a folder in the "Program Files" directory.  Its CSIDL value is:

   CSIDL_PROGRAMS
typically C:\Documents and Settings\<username>\Start Menu\Programs.
or C:\Windows\Start Menu\Programs
-- or --
  CSIDL_COMMON_PROGRAMS
typically C:\Documents and Settings\All Users\Start Menu\Programs

-- Dan
0
 
LVL 4

Expert Comment

by:aponcealbuerne
ID: 6385581
try this:


     CString strPathObj;
     CString strPathLink;
     IPersistFile* ppf;
     
     strPathObj = "c:\yourexefile.exe";
     LPITEMIDLIST plist;
     CString str;
     char pszPath[MAX_PATH];
     SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS , &plist);
     SHGetPathFromIDList(
          plist,
          pszPath);
     
     IShellLink *psl;
     strPathLink = pszPath;
     strPathLink += "\\";
     strPathLink += "The name you want to appear";
     strPathLink += ".lnk";
     CoInitialize(NULL);
     if (SUCCEEDED( CoCreateInstance(CLSID_ShellLink,
          NULL,
          CLSCTX_INPROC_SERVER,
          IID_IShellLink,
          (LPVOID*) &psl))
          )
         
          //IPersistFile* ppf;
         
     psl->SetPath(strPathObj);
     psl->SetIconLocation("c:\\youricofile.ico", 0);
     psl->SetDescription("Description");
     if (SUCCEEDED(psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf)))
     {
         
          WORD wsz[MAX_PATH];
          MultiByteToWideChar(CP_ACP,
               MB_PRECOMPOSED,
               strPathLink,
               -1,
               wsz,
               MAX_PATH);
         
          if ( SUCCEEDED ( ppf->Save(wsz, TRUE) ) )
               blnError = FALSE;
         
          ppf->Release();
     }
     psl->Release();

hope helps..
0
 

Author Comment

by:nitshv
ID: 6407870
Are these functions SHGetSpecialFolderPathA, etc compatible in Windows NT also ?
0
 
LVL 4

Accepted Solution

by:
aponcealbuerne earned 1200 total points
ID: 6407992
Yes, they are, i think you'll need the following includes:


#include "windows.h"
#include "windef.h"
#include "lmcons.h"
#include "lmapibuf.h"
#include "lmshare.h"
#include "lmerr.h"
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9521162
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: aponcealbuerne

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question