Announcement

Collapse
No announcement yet.

Need help creating non-exe shortcut files.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help creating non-exe shortcut files.

    I need to create shortcut files which point to data files.
    Code posted by Semen and Lance demonstrate how to create
    shortcuts on the start menu which point to programs. Browsing
    through the %CSIDL defs in Win32api.inc doesn't provide a clear
    direction to follow. (If you don't see %CSIDL in your include
    files, you need to download the latest versions).

    Can someone point to a publication which defines the use of the
    ishelllink api? Is it in Petzolds book?

    Thanks in advance

    John Kovacich

    ------------------
    Thanks,

    John Kovacich
    Ivory Tower Software

  • #2
    John, Check out this site . . . . . http://bcarroll.siscom.net/HTMLDocs/...IShellLink.htm

    Wes Brown


    ------------------

    Comment


    • #3
      john --
      you can find all information in msdn.
      i described my general approach to call com from pb - see

      if you will follow, you'll need c-declarations:
      Code:
      //===========================================================================
      //
      // ishelllink interface
      //
      //===========================================================================
      
      #ifdef unicode
      #define ishelllink      ishelllinkw
      #define ishelllinkvtbl  ishelllinkwvtbl
      #else
      #define ishelllink      ishelllinka
      #define ishelllinkvtbl  ishelllinkavtbl
      #endif
      
      // ishelllink::resolve fflags
      typedef enum {
          slr_no_ui           = 0x0001,
          slr_any_match       = 0x0002,
          slr_update          = 0x0004,
          slr_noupdate        = 0x0008,
      } slr_flags;
      
      // ishelllink::getpath fflags
      typedef enum {
          slgp_shortpath      = 0x0001,
          slgp_uncpriority    = 0x0002,
          slgp_rawpath        = 0x0004,
      } slgp_flags;
      
      #undef  interface
      #define interface   ishelllinka
      
      declare_interface_(ishelllinka, iunknown)       // sl
      {
          // *** iunknown methods ***
          stdmethod(queryinterface) (this_ refiid riid, lpvoid * ppvobj) pure;
          stdmethod_(ulong,addref) (this)  pure;
          stdmethod_(ulong,release) (this) pure;
      
          // *** ishelllink methods ***
          stdmethod(getpath)(this_ lpstr pszfile, int cchmaxpath, win32_find_dataa *pfd, dword fflags) pure;
      
          stdmethod(getidlist)(this_ lpitemidlist * ppidl) pure;
          stdmethod(setidlist)(this_ lpcitemidlist pidl) pure;
      
          stdmethod(getdescription)(this_ lpstr pszname, int cchmaxname) pure;
          stdmethod(setdescription)(this_ lpcstr pszname) pure;
      
          stdmethod(getworkingdirectory)(this_ lpstr pszdir, int cchmaxpath) pure;
          stdmethod(setworkingdirectory)(this_ lpcstr pszdir) pure;
      
          stdmethod(getarguments)(this_ lpstr pszargs, int cchmaxpath) pure;
          stdmethod(setarguments)(this_ lpcstr pszargs) pure;
      
          stdmethod(gethotkey)(this_ word *pwhotkey) pure;
          stdmethod(sethotkey)(this_ word whotkey) pure;
      
          stdmethod(getshowcmd)(this_ int *pishowcmd) pure;
          stdmethod(setshowcmd)(this_ int ishowcmd) pure;
      
          stdmethod(geticonlocation)(this_ lpstr psziconpath, int cchiconpath, int *piicon) pure;
          stdmethod(seticonlocation)(this_ lpcstr psziconpath, int iicon) pure;
      
          stdmethod(setrelativepath)(this_ lpcstr pszpathrel, dword dwreserved) pure;
      
          stdmethod(resolve)(this_ hwnd hwnd, dword fflags) pure;
      
          stdmethod(setpath)(this_ lpcstr pszfile) pure;
      };
      
      #undef  interface
      #define interface   ishelllinkw
      
      declare_interface_(ishelllinkw, iunknown)       // sl
      {
          // *** iunknown methods ***
          stdmethod(queryinterface) (this_ refiid riid, lpvoid * ppvobj) pure;
          stdmethod_(ulong,addref) (this)  pure;
          stdmethod_(ulong,release) (this) pure;
      
          // *** ishelllink methods ***
          stdmethod(getpath)(this_ lpwstr pszfile, int cchmaxpath, win32_find_dataw *pfd, dword fflags) pure;
      
          stdmethod(getidlist)(this_ lpitemidlist * ppidl) pure;
          stdmethod(setidlist)(this_ lpcitemidlist pidl) pure;
      
          stdmethod(getdescription)(this_ lpwstr pszname, int cchmaxname) pure;
          stdmethod(setdescription)(this_ lpcwstr pszname) pure;
      
          stdmethod(getworkingdirectory)(this_ lpwstr pszdir, int cchmaxpath) pure;
          stdmethod(setworkingdirectory)(this_ lpcwstr pszdir) pure;
      
          stdmethod(getarguments)(this_ lpwstr pszargs, int cchmaxpath) pure;
          stdmethod(setarguments)(this_ lpcwstr pszargs) pure;
      
          stdmethod(gethotkey)(this_ word *pwhotkey) pure;
          stdmethod(sethotkey)(this_ word whotkey) pure;
      
          stdmethod(getshowcmd)(this_ int *pishowcmd) pure;
          stdmethod(setshowcmd)(this_ int ishowcmd) pure;
      
          stdmethod(geticonlocation)(this_ lpwstr psziconpath, int cchiconpath, int *piicon) pure;
          stdmethod(seticonlocation)(this_ lpcwstr psziconpath, int iicon) pure;
      
          stdmethod(setrelativepath)(this_ lpcwstr pszpathrel, dword dwreserved) pure;
      
          stdmethod(resolve)(this_ hwnd hwnd, dword fflags) pure;
      
          stdmethod(setpath)(this_ lpcwstr pszfile) pure;
      };
      
      
      #ifdef _inc_shellapi    /* for lpshellexecuteinfo */

      ------------------
      e-mail: [email protected]

      Comment


      • #4
        Or make this window small, grab the IE icon from the address bar, and then toss on your desktop.

        Now open it with notepad.

        You'll notice that you can just use the WritePrivateProfileString api to do a shortcut like this and it will work on an y windows systemm..


        It's cheap but it's only one line of code....

        Scott


        ------------------
        Scott
        mailto:[email protected][email protected]</A>
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment


        • #5
          Thanks for your help.

          Can I run CoCreateInstance and CoUninitialize just once, during
          init and close? Or, since I am working with addresses, will I need
          to rerun it it with each request?

          Is QueryInterface the correct method to tells the interface that I am done
          setting attributes and am ready for it to create the shortcut? Or
          must I call Release to complete the transaction?

          John

          ------------------


          [This message has been edited by John Kovacich (edited December 28, 2000).]
          Thanks,

          John Kovacich
          Ivory Tower Software

          Comment


          • #6
            John --
            You can find MFC sample in http://msdn.microsoft.com/library/bo.../chpt09-04.htm

            I think that you can run CoCreateInstance and CoUninitialize once only.
            About Release. I don't exactly understand, about which interface do you talk
            (some interfaces are used; maybe MSDN sample will help here).

            About attributes. If you mean Shell-attributes, it's necessary to use two special enough hard COM interfaces.
            In Brad Martinez's VB explorer (you can find it using vbnet links) these interfaces are used, as I remember.

            ------------------
            E-MAIL: [email protected]

            Comment

            Working...
            X