• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 608
  • Last Modified:

How to Add Desktop shortcut Icon

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
nitshv
Asked:
nitshv
  • 3
  • 2
  • 2
  • +6
1 Solution
 
noushadxpCommented:


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
 
kkarunakarCommented:
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
 
kkarunakarCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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

--- Dan
0
 
nitshvAuthor Commented:
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
 
orenlevCommented:
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
 
nitshvAuthor Commented:
but How do i add a new folder in the start menu?
0
 
ShaunWildeCommented:
> 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
 
DanRollinsCommented:
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
 
aponcealbuerneCommented:
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
 
nitshvAuthor Commented:
Are these functions SHGetSpecialFolderPathA, etc compatible in Windows NT also ?
0
 
aponcealbuerneCommented:
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
 
Roshan DavisCommented:
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
  • 2
  • +6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now