Solved

How to Add Desktop shortcut Icon

Posted on 2001-08-08
14
589 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
  • 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
 
LVL 30

Expert Comment

by:Zoppo
ID: 6367046
0
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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 300 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 87
Expand macro to ask for filename column 8 35
ShiftLeft challenge 21 66
NotAlone Challenge 20 72
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now