Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. The Infomercial King Challenge

The Infomercial King Challenge

Scheduled Pinned Locked Moved The Lounge
csharpvisual-studiowpfdebuggingtutorial
47 Posts 18 Posters 76 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bill SerGio
    wrote on last edited by
    #1

    I develop on Windows 98 using Visual Studio 6 I noticed that the code below will NOT create a link on Windows 2000. Since I do NOT have Windows 2000 I can't debug this code so i am wondering if anyone has a solution to how to get the code below to create a lInk on windows 2000? Where UINT uLinkLoc = CSIDL_DESKTOP; Is there a way to write a SINGLE class that can create a link on the Desktop in both Windows 98 and Windows 2000 without compiling 2 separate versions(one UNICODE and one ASCII)??? bool CInstall::CreateShortCut( LPCSTR lpszSourceFile, LPCSTR lpszSourceDir, UINT uLinkLoc, LPCSTR lpszDesc, bool IsFolder ) { HRESULT hResult = NULL; IShellLink* pShellLink = NULL; bool rc = false; LPCSTR lpszDestination = NULL; ITEMIDLIST *id = NULL; TCHAR szLinkLoc[MAX_PATH] = ""; TCHAR szShellPath[MAX_PATH] = ""; CString sLinkLoc; sLinkLoc.Empty(); CString sLink; sLink.Empty(); // Initialize IShellLink interface hResult = CoInitialize(NULL); // Get pointer to IShellLink Interface hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink); if (SUCCEEDED(hResult)) { //Cache, Fonts, History, NetHood, Personal, Printhood, Programs, // Recent, SendTo, Start Menu, Startup, Templates, ShellNew if (uLinkLoc == CSIDL_APPDATA) { sLinkLoc = "AppData"; } else if (uLinkLoc == CSIDL_COOKIES) { sLinkLoc = "Cookies"; } else if (uLinkLoc == CSIDL_DESKTOP) { sLinkLoc = "Desktop"; } else if (uLinkLoc == CSIDL_STARTMENU) { sLinkLoc = "Start Menu"; } else if (uLinkLoc == CSIDL_STARTUP) { sLinkLoc = "Startup"; } else if (uLinkLoc == CSIDL_FAVORITES) { sLinkLoc = "Favorites"; } if (sLinkLoc.GetLength()>0) { GetShellFolderPath(sLinkLoc, szShellPath); sLink = szShellPath; } else { SHGetSpecialFolderLocation(NULL, uLinkLoc, &id); SHGetPathFromIDList(id, szLinkLoc); sLink = szLinkLoc; } sLink += "\\"; sLink += lpszDesc; sLink += ".lnk"; lpszDestination = (LPCSTR)sLink; if (IsFolder) { // Requies: #Include hResult = _mkdir(lpszDestination); // Clean up pShellLink->Release(); CoUninitialize(); if (SUCCEEDED(hResult)) { return true; } else { return false; } } IPersistFile* ppf = NULL; // Set path to shortcut target pShellLink->SetPath(lpszSourceFile); // Add Start Directory if(lpszSourceDir)

    B B E L D 8 Replies Last reply
    0
    • B Bill SerGio

      I develop on Windows 98 using Visual Studio 6 I noticed that the code below will NOT create a link on Windows 2000. Since I do NOT have Windows 2000 I can't debug this code so i am wondering if anyone has a solution to how to get the code below to create a lInk on windows 2000? Where UINT uLinkLoc = CSIDL_DESKTOP; Is there a way to write a SINGLE class that can create a link on the Desktop in both Windows 98 and Windows 2000 without compiling 2 separate versions(one UNICODE and one ASCII)??? bool CInstall::CreateShortCut( LPCSTR lpszSourceFile, LPCSTR lpszSourceDir, UINT uLinkLoc, LPCSTR lpszDesc, bool IsFolder ) { HRESULT hResult = NULL; IShellLink* pShellLink = NULL; bool rc = false; LPCSTR lpszDestination = NULL; ITEMIDLIST *id = NULL; TCHAR szLinkLoc[MAX_PATH] = ""; TCHAR szShellPath[MAX_PATH] = ""; CString sLinkLoc; sLinkLoc.Empty(); CString sLink; sLink.Empty(); // Initialize IShellLink interface hResult = CoInitialize(NULL); // Get pointer to IShellLink Interface hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink); if (SUCCEEDED(hResult)) { //Cache, Fonts, History, NetHood, Personal, Printhood, Programs, // Recent, SendTo, Start Menu, Startup, Templates, ShellNew if (uLinkLoc == CSIDL_APPDATA) { sLinkLoc = "AppData"; } else if (uLinkLoc == CSIDL_COOKIES) { sLinkLoc = "Cookies"; } else if (uLinkLoc == CSIDL_DESKTOP) { sLinkLoc = "Desktop"; } else if (uLinkLoc == CSIDL_STARTMENU) { sLinkLoc = "Start Menu"; } else if (uLinkLoc == CSIDL_STARTUP) { sLinkLoc = "Startup"; } else if (uLinkLoc == CSIDL_FAVORITES) { sLinkLoc = "Favorites"; } if (sLinkLoc.GetLength()>0) { GetShellFolderPath(sLinkLoc, szShellPath); sLink = szShellPath; } else { SHGetSpecialFolderLocation(NULL, uLinkLoc, &id); SHGetPathFromIDList(id, szLinkLoc); sLink = szLinkLoc; } sLink += "\\"; sLink += lpszDesc; sLink += ".lnk"; lpszDestination = (LPCSTR)sLink; if (IsFolder) { // Requies: #Include hResult = _mkdir(lpszDestination); // Clean up pShellLink->Release(); CoUninitialize(); if (SUCCEEDED(hResult)) { return true; } else { return false; } } IPersistFile* ppf = NULL; // Set path to shortcut target pShellLink->SetPath(lpszSourceFile); // Add Start Directory if(lpszSourceDir)

      B Offline
      B Offline
      Bill SerGio
      wrote on last edited by
      #2

      The include file ARE: #include "direct.h" #include "objbase.h" #include "shlguid.h" #include "wchar.h" tHIS SHOULD BE THE only INCLUDE FILES YOU NEED. "DIRECT.H" IS NEEDED for making directories in teh shell. the code works fine on windows 95, 98 and Windows XP. But it FAILS on windows 2000. Bill SerGio, The Infomercial King

      1 Reply Last reply
      0
      • B Bill SerGio

        I develop on Windows 98 using Visual Studio 6 I noticed that the code below will NOT create a link on Windows 2000. Since I do NOT have Windows 2000 I can't debug this code so i am wondering if anyone has a solution to how to get the code below to create a lInk on windows 2000? Where UINT uLinkLoc = CSIDL_DESKTOP; Is there a way to write a SINGLE class that can create a link on the Desktop in both Windows 98 and Windows 2000 without compiling 2 separate versions(one UNICODE and one ASCII)??? bool CInstall::CreateShortCut( LPCSTR lpszSourceFile, LPCSTR lpszSourceDir, UINT uLinkLoc, LPCSTR lpszDesc, bool IsFolder ) { HRESULT hResult = NULL; IShellLink* pShellLink = NULL; bool rc = false; LPCSTR lpszDestination = NULL; ITEMIDLIST *id = NULL; TCHAR szLinkLoc[MAX_PATH] = ""; TCHAR szShellPath[MAX_PATH] = ""; CString sLinkLoc; sLinkLoc.Empty(); CString sLink; sLink.Empty(); // Initialize IShellLink interface hResult = CoInitialize(NULL); // Get pointer to IShellLink Interface hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink); if (SUCCEEDED(hResult)) { //Cache, Fonts, History, NetHood, Personal, Printhood, Programs, // Recent, SendTo, Start Menu, Startup, Templates, ShellNew if (uLinkLoc == CSIDL_APPDATA) { sLinkLoc = "AppData"; } else if (uLinkLoc == CSIDL_COOKIES) { sLinkLoc = "Cookies"; } else if (uLinkLoc == CSIDL_DESKTOP) { sLinkLoc = "Desktop"; } else if (uLinkLoc == CSIDL_STARTMENU) { sLinkLoc = "Start Menu"; } else if (uLinkLoc == CSIDL_STARTUP) { sLinkLoc = "Startup"; } else if (uLinkLoc == CSIDL_FAVORITES) { sLinkLoc = "Favorites"; } if (sLinkLoc.GetLength()>0) { GetShellFolderPath(sLinkLoc, szShellPath); sLink = szShellPath; } else { SHGetSpecialFolderLocation(NULL, uLinkLoc, &id); SHGetPathFromIDList(id, szLinkLoc); sLink = szLinkLoc; } sLink += "\\"; sLink += lpszDesc; sLink += ".lnk"; lpszDestination = (LPCSTR)sLink; if (IsFolder) { // Requies: #Include hResult = _mkdir(lpszDestination); // Clean up pShellLink->Release(); CoUninitialize(); if (SUCCEEDED(hResult)) { return true; } else { return false; } } IPersistFile* ppf = NULL; // Set path to shortcut target pShellLink->SetPath(lpszSourceFile); // Add Start Directory if(lpszSourceDir)

        B Offline
        B Offline
        Brian Delahunty
        wrote on last edited by
        #3

        You shoudl probably put this in the Collaboration/Testing forum or the VC++ one. You'll get a better response ion there ;-)


        "When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks] "It's The Soapbox; topics are optional" Shog 9

        B 1 Reply Last reply
        0
        • B Brian Delahunty

          You shoudl probably put this in the Collaboration/Testing forum or the VC++ one. You'll get a better response ion there ;-)


          "When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks] "It's The Soapbox; topics are optional" Shog 9

          B Offline
          B Offline
          Bill SerGio
          wrote on last edited by
          #4

          When I posted this I was NOT aware of the other sections and you are right in that i should have placed it in a more appropriate place but I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. Bill SerGio, The Infomercial King

          B M E M C 5 Replies Last reply
          0
          • B Bill SerGio

            When I posted this I was NOT aware of the other sections and you are right in that i should have placed it in a more appropriate place but I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. Bill SerGio, The Infomercial King

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            Bill SerGio wrote: I have never wasted time worrying about such insignificant things. Accepted rules of conduct (including a BIG RED warning saying not to post PROGRAMMING questions here) are "insignificant"? Wow, do you tell that to the judges too? --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm

            R 1 Reply Last reply
            0
            • B Bill SerGio

              When I posted this I was NOT aware of the other sections and you are right in that i should have placed it in a more appropriate place but I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. Bill SerGio, The Infomercial King

              B Offline
              B Offline
              Brian Delahunty
              wrote on last edited by
              #6

              Bill SerGio wrote: Keep your eye upon the donut and NOT upon the hole. I would, but I don't like dohnuts ;-)


              "When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks] "It's The Soapbox; topics are optional" Shog 9

              1 Reply Last reply
              0
              • B Bill SerGio

                I develop on Windows 98 using Visual Studio 6 I noticed that the code below will NOT create a link on Windows 2000. Since I do NOT have Windows 2000 I can't debug this code so i am wondering if anyone has a solution to how to get the code below to create a lInk on windows 2000? Where UINT uLinkLoc = CSIDL_DESKTOP; Is there a way to write a SINGLE class that can create a link on the Desktop in both Windows 98 and Windows 2000 without compiling 2 separate versions(one UNICODE and one ASCII)??? bool CInstall::CreateShortCut( LPCSTR lpszSourceFile, LPCSTR lpszSourceDir, UINT uLinkLoc, LPCSTR lpszDesc, bool IsFolder ) { HRESULT hResult = NULL; IShellLink* pShellLink = NULL; bool rc = false; LPCSTR lpszDestination = NULL; ITEMIDLIST *id = NULL; TCHAR szLinkLoc[MAX_PATH] = ""; TCHAR szShellPath[MAX_PATH] = ""; CString sLinkLoc; sLinkLoc.Empty(); CString sLink; sLink.Empty(); // Initialize IShellLink interface hResult = CoInitialize(NULL); // Get pointer to IShellLink Interface hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink); if (SUCCEEDED(hResult)) { //Cache, Fonts, History, NetHood, Personal, Printhood, Programs, // Recent, SendTo, Start Menu, Startup, Templates, ShellNew if (uLinkLoc == CSIDL_APPDATA) { sLinkLoc = "AppData"; } else if (uLinkLoc == CSIDL_COOKIES) { sLinkLoc = "Cookies"; } else if (uLinkLoc == CSIDL_DESKTOP) { sLinkLoc = "Desktop"; } else if (uLinkLoc == CSIDL_STARTMENU) { sLinkLoc = "Start Menu"; } else if (uLinkLoc == CSIDL_STARTUP) { sLinkLoc = "Startup"; } else if (uLinkLoc == CSIDL_FAVORITES) { sLinkLoc = "Favorites"; } if (sLinkLoc.GetLength()>0) { GetShellFolderPath(sLinkLoc, szShellPath); sLink = szShellPath; } else { SHGetSpecialFolderLocation(NULL, uLinkLoc, &id); SHGetPathFromIDList(id, szLinkLoc); sLink = szLinkLoc; } sLink += "\\"; sLink += lpszDesc; sLink += ".lnk"; lpszDestination = (LPCSTR)sLink; if (IsFolder) { // Requies: #Include hResult = _mkdir(lpszDestination); // Clean up pShellLink->Release(); CoUninitialize(); if (SUCCEEDED(hResult)) { return true; } else { return false; } } IPersistFile* ppf = NULL; // Set path to shortcut target pShellLink->SetPath(lpszSourceFile); // Add Start Directory if(lpszSourceDir)

                E Offline
                E Offline
                Eddie Velasquez
                wrote on last edited by
                #7

                You're missing an include:

                #include <post_in_the_right_forum.h>


                Eddie Velasquez: A Squeezed Devil
                Checkout General Guidelines for C# Class Implementation

                1 Reply Last reply
                0
                • B Bill SerGio

                  I develop on Windows 98 using Visual Studio 6 I noticed that the code below will NOT create a link on Windows 2000. Since I do NOT have Windows 2000 I can't debug this code so i am wondering if anyone has a solution to how to get the code below to create a lInk on windows 2000? Where UINT uLinkLoc = CSIDL_DESKTOP; Is there a way to write a SINGLE class that can create a link on the Desktop in both Windows 98 and Windows 2000 without compiling 2 separate versions(one UNICODE and one ASCII)??? bool CInstall::CreateShortCut( LPCSTR lpszSourceFile, LPCSTR lpszSourceDir, UINT uLinkLoc, LPCSTR lpszDesc, bool IsFolder ) { HRESULT hResult = NULL; IShellLink* pShellLink = NULL; bool rc = false; LPCSTR lpszDestination = NULL; ITEMIDLIST *id = NULL; TCHAR szLinkLoc[MAX_PATH] = ""; TCHAR szShellPath[MAX_PATH] = ""; CString sLinkLoc; sLinkLoc.Empty(); CString sLink; sLink.Empty(); // Initialize IShellLink interface hResult = CoInitialize(NULL); // Get pointer to IShellLink Interface hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink); if (SUCCEEDED(hResult)) { //Cache, Fonts, History, NetHood, Personal, Printhood, Programs, // Recent, SendTo, Start Menu, Startup, Templates, ShellNew if (uLinkLoc == CSIDL_APPDATA) { sLinkLoc = "AppData"; } else if (uLinkLoc == CSIDL_COOKIES) { sLinkLoc = "Cookies"; } else if (uLinkLoc == CSIDL_DESKTOP) { sLinkLoc = "Desktop"; } else if (uLinkLoc == CSIDL_STARTMENU) { sLinkLoc = "Start Menu"; } else if (uLinkLoc == CSIDL_STARTUP) { sLinkLoc = "Startup"; } else if (uLinkLoc == CSIDL_FAVORITES) { sLinkLoc = "Favorites"; } if (sLinkLoc.GetLength()>0) { GetShellFolderPath(sLinkLoc, szShellPath); sLink = szShellPath; } else { SHGetSpecialFolderLocation(NULL, uLinkLoc, &id); SHGetPathFromIDList(id, szLinkLoc); sLink = szLinkLoc; } sLink += "\\"; sLink += lpszDesc; sLink += ".lnk"; lpszDestination = (LPCSTR)sLink; if (IsFolder) { // Requies: #Include hResult = _mkdir(lpszDestination); // Clean up pShellLink->Release(); CoUninitialize(); if (SUCCEEDED(hResult)) { return true; } else { return false; } } IPersistFile* ppf = NULL; // Set path to shortcut target pShellLink->SetPath(lpszSourceFile); // Add Start Directory if(lpszSourceDir)

                  L Offline
                  L Offline
                  loket
                  wrote on last edited by
                  #8

                  Mr extremly successfull movie producer why dont you invest some money and get yourself a copy of W2K ? ..Develop on 98..are you masochist? :wtf:

                  1 Reply Last reply
                  0
                  • B Bill SerGio

                    When I posted this I was NOT aware of the other sections and you are right in that i should have placed it in a more appropriate place but I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. Bill SerGio, The Infomercial King

                    E Offline
                    E Offline
                    Eddie Velasquez
                    wrote on last edited by
                    #9

                    Bill SerGio wrote: but I have never wasted time worrying about such insignificant things. So respect for the rules of conduct in this website is of no meaning to you? :confused::mad: You should get out of here!


                    Eddie Velasquez: A Squeezed Devil
                    Checkout General Guidelines for C# Class Implementation

                    1 Reply Last reply
                    0
                    • B Bill SerGio

                      I develop on Windows 98 using Visual Studio 6 I noticed that the code below will NOT create a link on Windows 2000. Since I do NOT have Windows 2000 I can't debug this code so i am wondering if anyone has a solution to how to get the code below to create a lInk on windows 2000? Where UINT uLinkLoc = CSIDL_DESKTOP; Is there a way to write a SINGLE class that can create a link on the Desktop in both Windows 98 and Windows 2000 without compiling 2 separate versions(one UNICODE and one ASCII)??? bool CInstall::CreateShortCut( LPCSTR lpszSourceFile, LPCSTR lpszSourceDir, UINT uLinkLoc, LPCSTR lpszDesc, bool IsFolder ) { HRESULT hResult = NULL; IShellLink* pShellLink = NULL; bool rc = false; LPCSTR lpszDestination = NULL; ITEMIDLIST *id = NULL; TCHAR szLinkLoc[MAX_PATH] = ""; TCHAR szShellPath[MAX_PATH] = ""; CString sLinkLoc; sLinkLoc.Empty(); CString sLink; sLink.Empty(); // Initialize IShellLink interface hResult = CoInitialize(NULL); // Get pointer to IShellLink Interface hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink); if (SUCCEEDED(hResult)) { //Cache, Fonts, History, NetHood, Personal, Printhood, Programs, // Recent, SendTo, Start Menu, Startup, Templates, ShellNew if (uLinkLoc == CSIDL_APPDATA) { sLinkLoc = "AppData"; } else if (uLinkLoc == CSIDL_COOKIES) { sLinkLoc = "Cookies"; } else if (uLinkLoc == CSIDL_DESKTOP) { sLinkLoc = "Desktop"; } else if (uLinkLoc == CSIDL_STARTMENU) { sLinkLoc = "Start Menu"; } else if (uLinkLoc == CSIDL_STARTUP) { sLinkLoc = "Startup"; } else if (uLinkLoc == CSIDL_FAVORITES) { sLinkLoc = "Favorites"; } if (sLinkLoc.GetLength()>0) { GetShellFolderPath(sLinkLoc, szShellPath); sLink = szShellPath; } else { SHGetSpecialFolderLocation(NULL, uLinkLoc, &id); SHGetPathFromIDList(id, szLinkLoc); sLink = szLinkLoc; } sLink += "\\"; sLink += lpszDesc; sLink += ".lnk"; lpszDestination = (LPCSTR)sLink; if (IsFolder) { // Requies: #Include hResult = _mkdir(lpszDestination); // Clean up pShellLink->Release(); CoUninitialize(); if (SUCCEEDED(hResult)) { return true; } else { return false; } } IPersistFile* ppf = NULL; // Set path to shortcut target pShellLink->SetPath(lpszSourceFile); // Add Start Directory if(lpszSourceDir)

                      D Offline
                      D Offline
                      David Wulff
                      wrote on last edited by
                      #10

                      :-D :-D :-D :-D :-D :-D :-D :-D Why does all the fun always start when I am out taking a sh!t? ____________________ David Wulff Neil says: dave i am a homosexual and i am in love with your father Dave says: That's okay son, eighteen years ago I was in love with your mother.

                      B L 2 Replies Last reply
                      0
                      • M Michael Dunn

                        Bill SerGio wrote: I have never wasted time worrying about such insignificant things. Accepted rules of conduct (including a BIG RED warning saying not to post PROGRAMMING questions here) are "insignificant"? Wow, do you tell that to the judges too? --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm

                        R Offline
                        R Offline
                        Rama Krishna Vavilala
                        wrote on last edited by
                        #11

                        :laugh: :laugh: :laugh: Did you forget that rules don't apply to the infomerical king? I am glad that I just woke up looks like fun has started. I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. - Bill Sergio in The Lounge - June 23, 2002

                        B 1 Reply Last reply
                        0
                        • B Bill SerGio

                          I develop on Windows 98 using Visual Studio 6 I noticed that the code below will NOT create a link on Windows 2000. Since I do NOT have Windows 2000 I can't debug this code so i am wondering if anyone has a solution to how to get the code below to create a lInk on windows 2000? Where UINT uLinkLoc = CSIDL_DESKTOP; Is there a way to write a SINGLE class that can create a link on the Desktop in both Windows 98 and Windows 2000 without compiling 2 separate versions(one UNICODE and one ASCII)??? bool CInstall::CreateShortCut( LPCSTR lpszSourceFile, LPCSTR lpszSourceDir, UINT uLinkLoc, LPCSTR lpszDesc, bool IsFolder ) { HRESULT hResult = NULL; IShellLink* pShellLink = NULL; bool rc = false; LPCSTR lpszDestination = NULL; ITEMIDLIST *id = NULL; TCHAR szLinkLoc[MAX_PATH] = ""; TCHAR szShellPath[MAX_PATH] = ""; CString sLinkLoc; sLinkLoc.Empty(); CString sLink; sLink.Empty(); // Initialize IShellLink interface hResult = CoInitialize(NULL); // Get pointer to IShellLink Interface hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink); if (SUCCEEDED(hResult)) { //Cache, Fonts, History, NetHood, Personal, Printhood, Programs, // Recent, SendTo, Start Menu, Startup, Templates, ShellNew if (uLinkLoc == CSIDL_APPDATA) { sLinkLoc = "AppData"; } else if (uLinkLoc == CSIDL_COOKIES) { sLinkLoc = "Cookies"; } else if (uLinkLoc == CSIDL_DESKTOP) { sLinkLoc = "Desktop"; } else if (uLinkLoc == CSIDL_STARTMENU) { sLinkLoc = "Start Menu"; } else if (uLinkLoc == CSIDL_STARTUP) { sLinkLoc = "Startup"; } else if (uLinkLoc == CSIDL_FAVORITES) { sLinkLoc = "Favorites"; } if (sLinkLoc.GetLength()>0) { GetShellFolderPath(sLinkLoc, szShellPath); sLink = szShellPath; } else { SHGetSpecialFolderLocation(NULL, uLinkLoc, &id); SHGetPathFromIDList(id, szLinkLoc); sLink = szLinkLoc; } sLink += "\\"; sLink += lpszDesc; sLink += ".lnk"; lpszDestination = (LPCSTR)sLink; if (IsFolder) { // Requies: #Include hResult = _mkdir(lpszDestination); // Clean up pShellLink->Release(); CoUninitialize(); if (SUCCEEDED(hResult)) { return true; } else { return false; } } IPersistFile* ppf = NULL; // Set path to shortcut target pShellLink->SetPath(lpszSourceFile); // Add Start Directory if(lpszSourceDir)

                          R Offline
                          R Offline
                          Rama Krishna Vavilala
                          wrote on last edited by
                          #12

                          I think your post is too small. You should have posted the entire .dsp file as text, .cpp and .h or probably base64 encoding of the .zip file having the entire source:-D I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. - Bill Sergio in The Lounge - June 23, 2002

                          B 1 Reply Last reply
                          0
                          • B Bill SerGio

                            I develop on Windows 98 using Visual Studio 6 I noticed that the code below will NOT create a link on Windows 2000. Since I do NOT have Windows 2000 I can't debug this code so i am wondering if anyone has a solution to how to get the code below to create a lInk on windows 2000? Where UINT uLinkLoc = CSIDL_DESKTOP; Is there a way to write a SINGLE class that can create a link on the Desktop in both Windows 98 and Windows 2000 without compiling 2 separate versions(one UNICODE and one ASCII)??? bool CInstall::CreateShortCut( LPCSTR lpszSourceFile, LPCSTR lpszSourceDir, UINT uLinkLoc, LPCSTR lpszDesc, bool IsFolder ) { HRESULT hResult = NULL; IShellLink* pShellLink = NULL; bool rc = false; LPCSTR lpszDestination = NULL; ITEMIDLIST *id = NULL; TCHAR szLinkLoc[MAX_PATH] = ""; TCHAR szShellPath[MAX_PATH] = ""; CString sLinkLoc; sLinkLoc.Empty(); CString sLink; sLink.Empty(); // Initialize IShellLink interface hResult = CoInitialize(NULL); // Get pointer to IShellLink Interface hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**) &pShellLink); if (SUCCEEDED(hResult)) { //Cache, Fonts, History, NetHood, Personal, Printhood, Programs, // Recent, SendTo, Start Menu, Startup, Templates, ShellNew if (uLinkLoc == CSIDL_APPDATA) { sLinkLoc = "AppData"; } else if (uLinkLoc == CSIDL_COOKIES) { sLinkLoc = "Cookies"; } else if (uLinkLoc == CSIDL_DESKTOP) { sLinkLoc = "Desktop"; } else if (uLinkLoc == CSIDL_STARTMENU) { sLinkLoc = "Start Menu"; } else if (uLinkLoc == CSIDL_STARTUP) { sLinkLoc = "Startup"; } else if (uLinkLoc == CSIDL_FAVORITES) { sLinkLoc = "Favorites"; } if (sLinkLoc.GetLength()>0) { GetShellFolderPath(sLinkLoc, szShellPath); sLink = szShellPath; } else { SHGetSpecialFolderLocation(NULL, uLinkLoc, &id); SHGetPathFromIDList(id, szLinkLoc); sLink = szLinkLoc; } sLink += "\\"; sLink += lpszDesc; sLink += ".lnk"; lpszDestination = (LPCSTR)sLink; if (IsFolder) { // Requies: #Include hResult = _mkdir(lpszDestination); // Clean up pShellLink->Release(); CoUninitialize(); if (SUCCEEDED(hResult)) { return true; } else { return false; } } IPersistFile* ppf = NULL; // Set path to shortcut target pShellLink->SetPath(lpszSourceFile); // Add Start Directory if(lpszSourceDir)

                            C Offline
                            C Offline
                            ColinDavies
                            wrote on last edited by
                            #13

                            Bill please check out my artice on this, its pretty well documented. Regardz Colin J Davies

                            Sonork ID 100.9197:Colin

                            More about me :-)

                            B D 2 Replies Last reply
                            0
                            • R Rama Krishna Vavilala

                              :laugh: :laugh: :laugh: Did you forget that rules don't apply to the infomerical king? I am glad that I just woke up looks like fun has started. I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. - Bill Sergio in The Lounge - June 23, 2002

                              B Offline
                              B Offline
                              Brian Delahunty
                              wrote on last edited by
                              #14

                              Ricku wrote: I am gald that I just woke up looks like fun has started And I'm just finished my day's work!! I don't think this'll turn into a flame war. not unless we move it to the soapbox.. but I can't see sergio moving with us.


                              "When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks] "It's The Soapbox; topics are optional" Shog 9

                              C 1 Reply Last reply
                              0
                              • D David Wulff

                                :-D :-D :-D :-D :-D :-D :-D :-D Why does all the fun always start when I am out taking a sh!t? ____________________ David Wulff Neil says: dave i am a homosexual and i am in love with your father Dave says: That's okay son, eighteen years ago I was in love with your mother.

                                B Offline
                                B Offline
                                Brian Delahunty
                                wrote on last edited by
                                #15

                                David Wulff wrote: Why does all the fun always start when I am out taking a sh!t? We plan it that way ;-)


                                "When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks] "It's The Soapbox; topics are optional" Shog 9

                                1 Reply Last reply
                                0
                                • R Rama Krishna Vavilala

                                  I think your post is too small. You should have posted the entire .dsp file as text, .cpp and .h or probably base64 encoding of the .zip file having the entire source:-D I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. - Bill Sergio in The Lounge - June 23, 2002

                                  B Offline
                                  B Offline
                                  Brian Delahunty
                                  wrote on last edited by
                                  #16

                                  Don't encourgae that man!!!! ;P


                                  "When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks] "It's The Soapbox; topics are optional" Shog 9

                                  1 Reply Last reply
                                  0
                                  • D David Wulff

                                    :-D :-D :-D :-D :-D :-D :-D :-D Why does all the fun always start when I am out taking a sh!t? ____________________ David Wulff Neil says: dave i am a homosexual and i am in love with your father Dave says: That's okay son, eighteen years ago I was in love with your mother.

                                    L Offline
                                    L Offline
                                    loket
                                    wrote on last edited by
                                    #17

                                    The entire CP is a conspiracy just to get you constopated.:-D

                                    P 1 Reply Last reply
                                    0
                                    • C ColinDavies

                                      Bill please check out my artice on this, its pretty well documented. Regardz Colin J Davies

                                      Sonork ID 100.9197:Colin

                                      More about me :-)

                                      B Offline
                                      B Offline
                                      Bill SerGio
                                      wrote on last edited by
                                      #18

                                      Hi, Thank you for at least offerring a suggestion, i appreciate it. I am unable to find the article you refer to? Can you provide a link to the article? Your product "Sonork" looks very interesting and I will have to check it out when i get a chance. why didn't you include a Peer-to-Peer file sharing system in it? I can get a minimum of $25 per 1,000 opt in email address per day if you generate opt in addressesfrom your customer base. Thank you again, and let me know where i can find your article. The problem is more interesting than I thought at first since I can get it to work if I compile with a UNICODE SWITCH turn on but then i would need 2 version of the code which is not acceptable or elegant. Bill Bill SerGio, The Infomercial King

                                      1 Reply Last reply
                                      0
                                      • B Brian Delahunty

                                        Ricku wrote: I am gald that I just woke up looks like fun has started And I'm just finished my day's work!! I don't think this'll turn into a flame war. not unless we move it to the soapbox.. but I can't see sergio moving with us.


                                        "When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks] "It's The Soapbox; topics are optional" Shog 9

                                        C Offline
                                        C Offline
                                        ColinDavies
                                        wrote on last edited by
                                        #19

                                        DO you have the Power to move it, or must I start using expletives. :-) Regardz Colin J Davies

                                        Sonork ID 100.9197:Colin

                                        More about me :-)

                                        B 1 Reply Last reply
                                        0
                                        • C ColinDavies

                                          DO you have the Power to move it, or must I start using expletives. :-) Regardz Colin J Davies

                                          Sonork ID 100.9197:Colin

                                          More about me :-)

                                          B Offline
                                          B Offline
                                          Brian Delahunty
                                          wrote on last edited by
                                          #20

                                          Colin Davies wrote: DO you have the Power to move it, or must I start using expletives. I don't have the Power... unfortunatly. :(( Anyway's, i'm off. See ye soon :-)


                                          "When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks] "It's The Soapbox; topics are optional" Shog 9

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups