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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. File attributes of a shortcut

File attributes of a shortcut

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 Posts 2 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.
  • M Offline
    M Offline
    Manfred Staiger
    wrote on last edited by
    #1

    Does anybody know by chance how to change the file attributes of a shortcut in a folder? CFile::Get/SetStatus and GetFileAttributes/SetFileAttributes don't work. Thanks in advance

    MS

    D 1 Reply Last reply
    0
    • M Manfred Staiger

      Does anybody know by chance how to change the file attributes of a shortcut in a folder? CFile::Get/SetStatus and GetFileAttributes/SetFileAttributes don't work. Thanks in advance

      MS

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Manfred Staiger wrote:

      CFile::Get/SetStatus and GetFileAttributes/SetFileAttributes don't work.

      Why not? What are they (not) doing? This works fine for a shortcut that is on my desktop:

      void main( void )
      {
      char szFile[] = "...\\Desktop\\Survivor.url";
      SetFileAttributes(szFile, GetFileAttributes(szFile) | FILE_ATTRIBUTE_READONLY);
      }


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      M 1 Reply Last reply
      0
      • D David Crow

        Manfred Staiger wrote:

        CFile::Get/SetStatus and GetFileAttributes/SetFileAttributes don't work.

        Why not? What are they (not) doing? This works fine for a shortcut that is on my desktop:

        void main( void )
        {
        char szFile[] = "...\\Desktop\\Survivor.url";
        SetFileAttributes(szFile, GetFileAttributes(szFile) | FILE_ATTRIBUTE_READONLY);
        }


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        M Offline
        M Offline
        Manfred Staiger
        wrote on last edited by
        #3

        It works! I didn't respect that the windows explorer hides the file extension .lnk even if you haven't checked the "hide file extensions" property. So I simply passed the incomplete filename to SetFileAttributes. Anyway, thank you for responding.

        MS

        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