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. General Programming
  3. C / C++ / MFC
  4. Creating Links On windows 2000

Creating Links On windows 2000

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutorialannouncement
14 Posts 6 Posters 0 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.
  • C ColinDavies

    Two more thinks to check for are if it works in both NTFS and FAT. Also NT5 /2000 uses shell link tracking, so check to see if a shortcut is moved that it still works. Regardz Colin J Davies

    Sonork ID 100.9197:Colin

    More about me :-)

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

    It seems that the more I test code and research this problem, that it is IMPOSSIBLE to write a single class and compile it to work for both Windows 98 and windows 2000. The ONLY solution seems to be to create 2 versions of a DLL or an EXE, one for UNICODe and one for ASCII to create links. Bill SerGio, The Infomercial King

    T 1 Reply Last reply
    0
    • B Bill SerGio

      Let me state the problem ANOTHER way: Microsoft says that The IShellLink interface has an ANSI version (IShellLinkA) and a Unicode version (IShellLinkW). The version that will be used depends on whether you compile for ANSI or Unicode. However, Microsoft® Windows® 95 and Windows 98 only support IShellLinkA. My question is this... Is there a way to compile a SINGLE CLASS that will work on BOTH Windows 98 and Windows 2000 to create Links depending on the platform? For example, can you do something like: if (b2000 || bNT) { // Use IShellLinkW } else { // use IShellLinkA } Do you have to compile 2 separate programs to create links? :-O Bill SerGio, The Infomercial King

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #4

      Am i missing something? Why doesn't IShellLinkA work on both '98 and 2k? They both work on XP AFAIK. :confused: --------

      Have you hugged your monitor today?

      --Shog9 --

      C B 2 Replies Last reply
      0
      • S Shog9 0

        Am i missing something? Why doesn't IShellLinkA work on both '98 and 2k? They both work on XP AFAIK. :confused: --------

        Have you hugged your monitor today?

        --Shog9 --

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

        Email me a release to test please Shog, It might be Bill's 2000 has a problem. Regardz Colin J Davies

        Sonork ID 100.9197:Colin

        More about me :-)

        1 Reply Last reply
        0
        • S Shog9 0

          Am i missing something? Why doesn't IShellLinkA work on both '98 and 2k? They both work on XP AFAIK. :confused: --------

          Have you hugged your monitor today?

          --Shog9 --

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

          It ONLY works only Windows 98 and I was surprised to learn this as you are! If you set _UNICODE, and compile it under UNICODE, as a SEPARATE exe or DLL then it works ONLY on Windows 98. So far, nobody has created a class or piece of code that will compile and create a SINGLE exe or DLL that works on BOTH Windows 98 and Windows 2000. Bill SerGio, The Infomercial King

          B 1 Reply Last reply
          0
          • B Bill SerGio

            It ONLY works only Windows 98 and I was surprised to learn this as you are! If you set _UNICODE, and compile it under UNICODE, as a SEPARATE exe or DLL then it works ONLY on Windows 98. So far, nobody has created a class or piece of code that will compile and create a SINGLE exe or DLL that works on BOTH Windows 98 and Windows 2000. Bill SerGio, The Infomercial King

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

            Please excuse my type... i meant... If you set _UNICODE, and compile it under UNICODE, as a SEPARATE exe or DLL then it works ONLY on WINDOWS 2000. Bill SerGio, The Infomercial King

            C 1 Reply Last reply
            0
            • B Bill SerGio

              It seems that the more I test code and research this problem, that it is IMPOSSIBLE to write a single class and compile it to work for both Windows 98 and windows 2000. The ONLY solution seems to be to create 2 versions of a DLL or an EXE, one for UNICODe and one for ASCII to create links. Bill SerGio, The Infomercial King

              T Offline
              T Offline
              Tim Smith
              wrote on last edited by
              #8

              There is no reason to build both a UNICODE and ASCII version. Just call the W and A routines directly based on the OS. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

              B 1 Reply Last reply
              0
              • T Tim Smith

                There is no reason to build both a UNICODE and ASCII version. Just call the W and A routines directly based on the OS. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

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

                That is what I thought originally and it turns out NOT to work which surprised me. the reason that it fails is that if you include a condition based on the operating system as follows: if (b2000 || bNT) { // Use Unicode } else { // Use ASCII } The reason it fails has to do with the fact that you can't get the code to compile on Windows 98. Remember I am developing on Windows 98 and this is the problem. For example, "SHGetSpecialFolderLocation()" works on Windows 98 but the call for the UNICODE function, "ShGetFolderPath()" FAILS to compile on a Windows 98 machine using Visual Studio UNLESS YOU COMPILE with unicode which renders the code useless on Windows 98 Bill SerGio, The Infomercial King

                S L N 3 Replies Last reply
                0
                • B Bill SerGio

                  That is what I thought originally and it turns out NOT to work which surprised me. the reason that it fails is that if you include a condition based on the operating system as follows: if (b2000 || bNT) { // Use Unicode } else { // Use ASCII } The reason it fails has to do with the fact that you can't get the code to compile on Windows 98. Remember I am developing on Windows 98 and this is the problem. For example, "SHGetSpecialFolderLocation()" works on Windows 98 but the call for the UNICODE function, "ShGetFolderPath()" FAILS to compile on a Windows 98 machine using Visual Studio UNLESS YOU COMPILE with unicode which renders the code useless on Windows 98 Bill SerGio, The Infomercial King

                  S Offline
                  S Offline
                  Shog9 0
                  wrote on last edited by
                  #10

                  Bill SerGio wrote: For example, "SHGetSpecialFolderLocation()" works on Windows 98 but the call for the UNICODE function, "ShGetFolderPath()" FAILS to compile on a Windows 98 machine using Visual Studio UNLESS YOU COMPILE with unicode which renders the code useless on Windows 98 You may have a problem with your VS installation. Or possibly need updated SDK header files, not sure. SHGetFolderPath() was introduced as a shortcut for the most common use of SHGetSpecialFolderLocation(), and requires that a separate DLL (SHFolder.dll) be installed. It does however work on both Win98 and Win2k should these criteria be met. Or you can just use SHGetSpecialFolderLocation() and SHGetPathFromIDList() to accomplish (mostly) the same thing (but you'll have to do your own handling for CSIDL that are user-specific or not implemented on 98 (ex: CSIDL_PROGRAM_FILES_COMMON, CSIDL_COMMON_DOCUMENTS). --------

                  Have you hugged your monitor today?

                  --Shog9 --

                  1 Reply Last reply
                  0
                  • B Bill SerGio

                    That is what I thought originally and it turns out NOT to work which surprised me. the reason that it fails is that if you include a condition based on the operating system as follows: if (b2000 || bNT) { // Use Unicode } else { // Use ASCII } The reason it fails has to do with the fact that you can't get the code to compile on Windows 98. Remember I am developing on Windows 98 and this is the problem. For example, "SHGetSpecialFolderLocation()" works on Windows 98 but the call for the UNICODE function, "ShGetFolderPath()" FAILS to compile on a Windows 98 machine using Visual Studio UNLESS YOU COMPILE with unicode which renders the code useless on Windows 98 Bill SerGio, The Infomercial King

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

                    You dont need to do any test for OS just call CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void**) &pShellLink); if it succeedes use the IShellLinkW interface. If it fails create the IShellLinkA interface.

                    B 1 Reply Last reply
                    0
                    • B Bill SerGio

                      Please excuse my type... i meant... If you set _UNICODE, and compile it under UNICODE, as a SEPARATE exe or DLL then it works ONLY on WINDOWS 2000. Bill SerGio, The Infomercial King

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

                      I'm confused, Shog9's app work on my Win 2000 and 98 for me. Have you mangled your 2000 ? Regardz Colin J Davies

                      Sonork ID 100.9197:Colin

                      More about me :-)

                      1 Reply Last reply
                      0
                      • L loket

                        You dont need to do any test for OS just call CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void**) &pShellLink); if it succeedes use the IShellLinkW interface. If it fails create the IShellLinkA interface.

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

                        I am impressed! I must admit that I did not think of this as a switch instead of a switch based on the operating system. i will write a demo program and post it and see if what happens--let you know in a little while. By the way--this is a BRILLIANT suggestion to first try for IID_IShellLinkW and if it fails use IID_IShellLinkA. And I might point out that in all the samples of code to create links, nobody has thought to do this! Bill SerGio, The Infomercial King

                        1 Reply Last reply
                        0
                        • B Bill SerGio

                          That is what I thought originally and it turns out NOT to work which surprised me. the reason that it fails is that if you include a condition based on the operating system as follows: if (b2000 || bNT) { // Use Unicode } else { // Use ASCII } The reason it fails has to do with the fact that you can't get the code to compile on Windows 98. Remember I am developing on Windows 98 and this is the problem. For example, "SHGetSpecialFolderLocation()" works on Windows 98 but the call for the UNICODE function, "ShGetFolderPath()" FAILS to compile on a Windows 98 machine using Visual Studio UNLESS YOU COMPILE with unicode which renders the code useless on Windows 98 Bill SerGio, The Infomercial King

                          N Offline
                          N Offline
                          Navin
                          wrote on last edited by
                          #14

                          I had a similar problem once - I had to call a Windows 2000 machine but I was developing on NT. The solution (in pseudocode) was something like this: if(IsOs2000()) { Explicitly load the system DLL that has the function using LoadLibrary Get the function poitner using GetProcAddress Call the function Unload the DLL if necessary } Just a thought. Ugly, I know, but it might work in your situation. Even if you win the rat race, you're still a rat.

                          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