Announcement

Collapse
No announcement yet.

CreateLink

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

  • CreateLink

    I have an usb-flash-drive with write protect switch.

    I had a problem in XP/SP3 in connection with the function ShellExecute.
    At that time I had a replacement function PB SHELL.

    Now I have the same error message with CreateLink.
    Error:


    The error appears only if a link to a program will generate and the usb flash drive is write protected.

    It is likely that the error depends on the Windows patch status.
    Is there a solution that always works?

  • #2
    What is the "solution" you seek?

    Looks to me like the install software (autorunnerX, autorunnerU) is performing 'as designed,' telling you what the problem is and giving you a chance to correct it or give up for now.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      The new version of AutoRunnerX be a shortcut (from portable program) on the desktop when a usb flash drive is inserted.

      The error is displayed only when a link of a exe-file is created and if the usb flash drive / flash card is read-only protected.

      I have use the following code:
      http://www.powerbasic.com/support/pb...ad.php?t=12874

      Comment


      • #4
        I don't think the AutoRunner software is considering this an error; it appears to be handling this situation by telling you what's going on and giving you some options.

        Sounds like you would prefer autorunner to just exit with some kind of error code; except it's not designed to do that.

        That is, if you want something else to happen when the card is write protected, you'll either have to detemine that yourself BEFORE you hand over control to AutoRunner; or see if AutoRunner can change some behavior or has some other function you can call first to determine that; or find another way (sans AutoRunner) to create the link.


        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Problem is only with XP (test with SP2, SP3).
          Problem is not under VISTA.

          I have not programmed the error message. This is a system message!

          My question is whether there is a possibility that Create Link also under XP
          (without error message if the drive is write protected).
          Last edited by Bernhard Fomm; 8 Sep 2008, 11:30 AM.

          Comment


          • #6
            Error showing

            I think what he wants is XP2/3 to behave the same as Vista does in the same situation.

            M$ designed Vista as a COMPLETELY DIFFERENT ANIMAL!!!!

            Long live XP!

            LEARNING EXPERIENCE: What you get when you didn't get what you THOUGHT you wanted!

            Comment


            • #7
              @Wayne: I not understand your contribution.

              -Take a SD-card and copy a portable program it.
              -Then activated the write protection switch of the SD-card!
              -Create a shortcut to the program to the desktop!
              -Use the following lines:

              Code:
              #DIM ALL
              #COMPILE EXE
              #INCLUDE "Win32Api.inc"
              
              ' =======================================================================================
              ' Constants
              ' =======================================================================================
              %CLSCTX_INPROC_SERVER = &H1    ' Component is allowed in the same process space.
              ' =======================================================================================
              
              ' =======================================================================================
              ' IIDs
              ' =======================================================================================
              $CLSID_ShellLink = GUID$("{00021401-0000-0000-C000-000000000046}")
              $IID_IShellLink = GUID$("{000214EE-0000-0000-C000-000000000046}")
              $IID_IPersistFile = GUID$("{0000010B-0000-0000-C000-000000000046}")
              ' =======================================================================================
              
              ' =======================================================================================
              ' Returns a pointer to a specified interface on an object to which a client currently
              ' holds an interface pointer.
              ' =======================================================================================
              FUNCTION IUnknown_QueryInterface (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
                LOCAL HRESULT AS LONG
                CALL DWORD @@pthis[0] USING IUnknown_QueryInterface (pthis, riid, ppvObj) TO HRESULT
                FUNCTION = HRESULT
              END FUNCTION
              ' =======================================================================================
              
              ' =======================================================================================
              ' Decrements the reference count for the calling interface on a object. If the reference
              ' count on the object falls to 0, the object is freed from memory.
              ' =======================================================================================
              FUNCTION IUnknown_Release (BYVAL pthis AS DWORD PTR) AS DWORD
                LOCAL DWRESULT AS DWORD
                CALL DWORD @@pthis[2] USING IUnknown_Release (pthis) TO   DWRESULT
                FUNCTION = DWRESULT
              END FUNCTION
              ' =======================================================================================
              
              ' =======================================================================================
              ' Sets the description string for a Shell link object.
              ' =======================================================================================
              FUNCTION IShellLink_SetDescription (BYVAL pthis AS DWORD PTR, BYREF pszName AS ASCIIZ) AS LONG
                LOCAL HRESULT AS LONG
                CALL DWORD @@pthis[7] USING IShellLink_SetDescription (pthis, pszName) TO HRESULT
                FUNCTION = HRESULT
              END FUNCTION
              ' =======================================================================================
              
              ' =======================================================================================
              ' Sets the name of the working directory for a Shell link object.
              ' =======================================================================================
              FUNCTION IShellLink_SetWorkingDirectory (BYVAL pthis AS DWORD PTR, BYREF pszDir AS ASCIIZ) AS LONG
                LOCAL HRESULT AS LONG
                CALL DWORD @@pthis[9] USING IShellLink_SetWorkingDirectory (pthis, pszDir) TO HRESULT
                FUNCTION = HRESULT
              END FUNCTION
              ' =======================================================================================
              
              ' =======================================================================================
              ' Sets the command-line arguments for a Shell link object.
              ' =======================================================================================
              FUNCTION IShellLink_SetArguments (BYVAL pthis AS DWORD PTR, BYREF pszArgs AS ASCIIZ) AS LONG
                LOCAL HRESULT AS LONG
                CALL DWORD @@pthis[11] USING IShellLink_SetArguments (pthis, pszArgs) TO HRESULT
                FUNCTION = HRESULT
              END FUNCTION
              ' =======================================================================================
              
              ' =======================================================================================
              ' Sets the show command for a Shell link object. The show command sets the initial show
              ' state of the window.
              ' =======================================================================================
              FUNCTION IShellLink_SetShowCmd (BYVAL pthis AS DWORD PTR, BYVAL iShowCmd AS LONG) AS LONG
                LOCAL HRESULT AS LONG
                CALL DWORD @@pthis[15] USING IShellLink_SetShowCmd (pthis, iShowCmd) TO HRESULT
                FUNCTION = HRESULT
              END FUNCTION
              ' =======================================================================================
              
              ' =======================================================================================
              ' Sets the path and file name of a Shell link object.
              ' =======================================================================================
              FUNCTION IShellLink_SetPath (BYVAL pthis AS DWORD PTR, BYREF pszFile AS ASCIIZ) AS LONG
                LOCAL HRESULT AS LONG
                CALL DWORD @@pthis[20] USING IShellLink_SetPath (pthis, pszFile) TO HRESULT
                FUNCTION = HRESULT
              END FUNCTION
              ' =======================================================================================
              
              ' =======================================================================================
              ' Saves the object into the specified file.
              ' =======================================================================================
              DECLARE FUNCTION Proto_IPersistFile_Save (BYVAL pthis AS DWORD PTR, BYVAL pszFileName AS DWORD, BYVAL fRemember AS LONG) AS LONG
              ' =======================================================================================
              FUNCTION IPersistFile_Save (BYVAL pthis AS DWORD PTR, BYVAL strFileName AS STRING, BYVAL fRemember AS LONG) AS LONG
                LOCAL HRESULT AS LONG
                LOCAL pszFileName AS DWORD
                IF LEN(strFileName) THEN
                   strFileName = UCODE$(strFileName) & $NUL
                   pszFileName = STRPTR(strFileName)
                END IF
                CALL DWORD @@pthis[6] USING Proto_IPersistFile_Save (pthis, pszFileName, fRemember) TO HRESULT
                FUNCTION = HRESULT
              END FUNCTION
              ' =======================================================================================
              
              
              ' =======================================================================================
              ' Creates a shortcut
              ' =======================================================================================
              FUNCTION CreateLink ( _
                 BYVAL csidl AS LONG _         ' // Value specifying the folder for which to retrieve the location.
               , szLinkName AS ASCIIZ _        ' // Name of the shortcut
               , szExePath AS ASCIIZ _         ' // Path of the executable file
               , szArguments AS ASCIIZ _       ' // Arguments
               , szWorkingDir AS ASCIIZ _      ' // Working directory
               , BYVAL nShowCmd AS DWORD _     ' // Show command flag
               , szComment AS ASCIIZ _         ' // Comment
               ) AS LONG
              
                 LOCAL hr AS LONG                         ' // HRESULT
                 LOCAL psl AS DWORD                       ' // IShellLink interface reference
                 LOCAL ppf AS DWORD                       ' // IPersistFile interrace reference
                 LOCAL CLSID_ShellLink AS GUID            ' // ShellLink class identifier
                 LOCAL IID_IShellLink AS GUID             ' // IShellLink interface identifier
                 LOCAL IID_IPersistFile AS GUID           ' // IPersistFile interface identifier
                 LOCAL pidl AS DWORD                      ' // Item identifier list specifying the folder location
                 LOCAL szFileName AS ASCIIZ * %MAX_PATH   ' // Name of the .LNK file
              
                 ' // Fills the guids
                 CLSID_ShellLink = $CLSID_ShellLink
                 IID_IShellLink = $IID_IShellLink
                 IID_IPersistFile = $IID_IPersistFile
              
                 ' // Creates an instance of the IShellLink interface
                 hr = CoCreateInstance(CLSID_ShellLink, BYVAL %NULL, %CLSCTX_INPROC_SERVER, IID_IShellLink, psl)
                 IF hr <> %S_OK THEN EXIT FUNCTION
              
                 ' // Sets the properties of the shortcut
                 hr = IShellLink_SetPath(psl, szExePath)
                 hr = IShellLink_SetArguments(psl, szArguments)
                 hr = IShellLink_SetWorkingDirectory(psl, szWorkingDir)
                 hr = IShellLink_SetShowCmd(psl, nShowCmd)
                 hr = IShellLink_SetDescription(psl, szComment)
              
                 ' // Retrieves a pointer to the IPersistFile interface
                 hr = IUnknown_QueryInterface(psl, IID_IPersistFile, ppf)
                 IF hr = %S_OK THEN
                    ' // Retrieves an item identifier list specifying the desktop folder location
                    hr = SHGetSpecialFolderLocation(%HWND_DESKTOP, csidl, pidl)
                    IF hr = %NOERROR THEN
                       ' // Retrieves the path from the item identifier list
                       hr = SHGetPathFromIDList(BYVAL pidl, szFileName)
                       ' // Frees the memory allocated for the item identifier list
                       CoTaskMemFree pidl
                       IF ISTRUE(hr) THEN
                          ' // Full path
                          szFileName = szFileName & "\" & szLinkName & ".LNK"
                          ' // Saves the shortcut file
                          hr = IPersistFile_Save (ppf, szFileName, %TRUE)
                  ' [B][COLOR="Red"]SYSTEM ERROR MESSAGE, WHEN DRIVE IS READ-ONLY[/COLOR][/B]
                       END IF
                       FUNCTION = %TRUE
                    END IF
                    ' // Releases the IPersistFile interface
                    IUnknown_Release ppf
                 END IF
              
                 ' // Releases the IShellLink interface
                 IUnknown_Release psl
              
              END FUNCTION
              ' =======================================================================================
              
              ' =======================================================================================
              ' Main
              ' =======================================================================================
              FUNCTION PBMAIN
              LOCAL hr AS LONG
              LOCAL fn AS ASCIIZ * %MAX_PATH
              
                  fn = "X:\test.exe"
                  
              [COLOR="Red"]    ' The file must exists on X:
                  ' The file must a EXE file
                  ' X: = SD-Card or USB flash drive; (not equal CD-ROM drive!)
                  ' X: = write protected switch activate!
              [/COLOR]    
                  hr = CreateLink(%CSIDL_DESKTOP, "PB shortcut", fn, "My Arguments", CURDIR$, %SW_NORMAL, "My comment")
              
                  IF ISFALSE (hr)THEN
                      MSGBOX "CreateLink failed"
                  END IF
              
              END FUNCTION
              Result under XP:

              Last edited by Bernhard Fomm; 10 Sep 2008, 11:11 AM.

              Comment


              • #8
                Try downloading FileMon from Microsoft and see what is truly happening.

                It appears that something is being written, but to uncover exactly what, FileMon should help you narrow it down.
                <b>George W. Bleck</b>
                <img src='http://www.blecktech.com/myemail.gif'>

                Comment


                • #9

                  Comment


                  • #10
                    filemon - good idea! Why is "SET INFORMATION"?

                    And why only exe-files?

                    When I have the Explorer create a shortcut, it will also "SET INFORMATION".
                    But the error message is not displayed.
                    Last edited by Bernhard Fomm; 10 Sep 2008, 01:19 PM.

                    Comment


                    • #11
                      I would guess Information could be attributes, permissions, NT updating the last access timestamp, etc.
                      sigpic
                      Mobile Solutions
                      Sys Analyst and Development

                      Comment


                      • #12
                        My guess is that drive I is the USB drive, and at some point under the hood, creating shortcut reads info, but either at some point tries to set a flag (whether its busy, or a bookmark while another process gets a time slice, or something else) tries to write to the drive it is reading for info, and since it is locked...error

                        I could be wayyyy off....but its a thought
                        Engineer's Motto: If it aint broke take it apart and fix it

                        "If at 1st you don't succeed... call it version 1.0"

                        "Half of Programming is coding"....."The other 90% is DEBUGGING"

                        "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                        Comment


                        • #13
                          Originally posted by Roger Garstang View Post
                          I would guess Information could be attributes, permissions, NT updating the last access timestamp, etc.
                          But why only exe-files?

                          Comment


                          • #14
                            Originally posted by Bernhard Fomm View Post
                            But why only exe-files?
                            Last Accessed Time-stamp. I don't believe data files are updated this way until they are actually used. Since they aren't used until a program opens them, you'd get this error "only on exe-files"
                            Software makes Hardware Happen

                            Comment


                            • #15
                              What is there still a possibility to create shortcuts?

                              Comment


                              • #16
                                if somebody has an idea:
                                i have founded out that exe-files on CDs don't create the error message... :rockwoot:

                                Comment


                                • #17
                                  I have found solution in the PureBasic-Forum.
                                  One question, an answer. The PureBasic-guys are good.

                                  old = SetErrorMode(%SEM_FAILCRITICALERRORS)
                                  hr = IPersistFile_Save (ppf, szFileName, %TRUE)
                                  SetErrorMode old

                                  With the function SetErrorMode switch off the system-error-message.


                                  Code:
                                  #DIM ALL
                                  #COMPILE EXE
                                  #INCLUDE "Win32Api.inc"
                                  
                                  
                                  ' =======================================================================================
                                  ' Constants
                                  ' =======================================================================================
                                  %CLSCTX_INPROC_SERVER = &H1    ' Component is allowed in the same process space.
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' IIDs
                                  ' =======================================================================================
                                  $CLSID_ShellLink = GUID$("{00021401-0000-0000-C000-000000000046}")
                                  $IID_IShellLink = GUID$("{000214EE-0000-0000-C000-000000000046}")
                                  $IID_IPersistFile = GUID$("{0000010B-0000-0000-C000-000000000046}")
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Returns a pointer to a specified interface on an object to which a client currently
                                  ' holds an interface pointer.
                                  ' =======================================================================================
                                  FUNCTION IUnknown_QueryInterface (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
                                    LOCAL HRESULT AS LONG
                                    CALL DWORD @@pthis[0] USING IUnknown_QueryInterface (pthis, riid, ppvObj) TO HRESULT
                                    FUNCTION = HRESULT
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Decrements the reference count for the calling interface on a object. If the reference
                                  ' count on the object falls to 0, the object is freed from memory.
                                  ' =======================================================================================
                                  FUNCTION IUnknown_Release (BYVAL pthis AS DWORD PTR) AS DWORD
                                    LOCAL DWRESULT AS DWORD
                                    CALL DWORD @@pthis[2] USING IUnknown_Release (pthis) TO   DWRESULT
                                    FUNCTION = DWRESULT
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Sets the description string for a Shell link object.
                                  ' =======================================================================================
                                  FUNCTION IShellLink_SetDescription (BYVAL pthis AS DWORD PTR, BYREF pszName AS ASCIIZ) AS LONG
                                    LOCAL HRESULT AS LONG
                                    CALL DWORD @@pthis[7] USING IShellLink_SetDescription (pthis, pszName) TO HRESULT
                                    FUNCTION = HRESULT
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Sets the name of the working directory for a Shell link object.
                                  ' =======================================================================================
                                  FUNCTION IShellLink_SetWorkingDirectory (BYVAL pthis AS DWORD PTR, BYREF pszDir AS ASCIIZ) AS LONG
                                    LOCAL HRESULT AS LONG
                                    CALL DWORD @@pthis[9] USING IShellLink_SetWorkingDirectory (pthis, pszDir) TO HRESULT
                                    FUNCTION = HRESULT
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Sets the command-line arguments for a Shell link object.
                                  ' =======================================================================================
                                  FUNCTION IShellLink_SetArguments (BYVAL pthis AS DWORD PTR, BYREF pszArgs AS ASCIIZ) AS LONG
                                    LOCAL HRESULT AS LONG
                                    CALL DWORD @@pthis[11] USING IShellLink_SetArguments (pthis, pszArgs) TO HRESULT
                                    FUNCTION = HRESULT
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Sets the show command for a Shell link object. The show command sets the initial show
                                  ' state of the window.
                                  ' =======================================================================================
                                  FUNCTION IShellLink_SetShowCmd (BYVAL pthis AS DWORD PTR, BYVAL iShowCmd AS LONG) AS LONG
                                    LOCAL HRESULT AS LONG
                                    CALL DWORD @@pthis[15] USING IShellLink_SetShowCmd (pthis, iShowCmd) TO HRESULT
                                    FUNCTION = HRESULT
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Sets the path and file name of a Shell link object.
                                  ' =======================================================================================
                                  FUNCTION IShellLink_SetPath (BYVAL pthis AS DWORD PTR, BYREF pszFile AS ASCIIZ) AS LONG
                                    LOCAL HRESULT AS LONG
                                    CALL DWORD @@pthis[20] USING IShellLink_SetPath (pthis, pszFile) TO HRESULT
                                    FUNCTION = HRESULT
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Saves the object into the specified file.
                                  ' =======================================================================================
                                  DECLARE FUNCTION Proto_IPersistFile_Save (BYVAL pthis AS DWORD PTR, BYVAL pszFileName AS DWORD, BYVAL fRemember AS LONG) AS LONG
                                  ' =======================================================================================
                                  FUNCTION IPersistFile_Save (BYVAL pthis AS DWORD PTR, BYVAL strFileName AS STRING, BYVAL fRemember AS LONG) AS LONG
                                    LOCAL HRESULT AS LONG
                                    LOCAL pszFileName AS DWORD
                                    IF LEN(strFileName) THEN
                                       strFileName = UCODE$(strFileName) & $NUL
                                       pszFileName = STRPTR(strFileName)
                                    END IF
                                    CALL DWORD @@pthis[6] USING Proto_IPersistFile_Save (pthis, pszFileName, fRemember) TO HRESULT
                                    FUNCTION = HRESULT
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Creates a shortcut
                                  ' =======================================================================================
                                  FUNCTION CreateLink ( BYVAL csidl AS LONG _               ' // Value specifying the folder for which to retrieve the location.
                                                            , szLinkName AS ASCIIZ _        ' // Name of the shortcut
                                                            , szExePath AS ASCIIZ _         ' // Path of the executable file
                                                            , szArguments AS ASCIIZ _       ' // Arguments
                                                            , szWorkingDir AS ASCIIZ _      ' // Working directory
                                                            , BYVAL nShowCmd AS DWORD _     ' // Show command flag
                                                            , szComment AS ASCIIZ _         ' // Comment
                                                            ) AS LONG
                                  
                                  [B]LOCAL old              AS DWORD[/B]
                                  LOCAL hr               AS LONG                            ' // HRESULT
                                  LOCAL psl              AS DWORD                           ' // IShellLink interface reference
                                  LOCAL ppf              AS DWORD                           ' // IPersistFile interrace reference
                                  LOCAL CLSID_ShellLink  AS GUID                            ' // ShellLink class identifier
                                  LOCAL IID_IShellLink   AS GUID                            ' // IShellLink interface identifier
                                  LOCAL IID_IPersistFile AS GUID                            ' // IPersistFile interface identifier
                                  LOCAL pidl             AS DWORD                           ' // Item identifier list specifying the folder location
                                  LOCAL szFileName       AS ASCIIZ * %MAX_PATH              ' // Name of the .LNK file
                                  
                                      ' // Fills the guids
                                      CLSID_ShellLink  = $CLSID_ShellLink
                                      IID_IShellLink   = $IID_IShellLink
                                      IID_IPersistFile = $IID_IPersistFile
                                  
                                      ' // Creates an instance of the IShellLink interface
                                      hr = CoCreateInstance(CLSID_ShellLink, BYVAL %NULL, %CLSCTX_INPROC_SERVER, IID_IShellLink, psl)
                                      IF hr <> %S_OK THEN EXIT FUNCTION
                                  
                                      ' // Sets the properties of the shortcut
                                      hr = IShellLink_SetPath(psl, szExePath)
                                      hr = IShellLink_SetArguments(psl, szArguments)
                                      hr = IShellLink_SetWorkingDirectory(psl, szWorkingDir)
                                      hr = IShellLink_SetShowCmd(psl, nShowCmd)
                                      hr = IShellLink_SetDescription(psl, szComment)
                                  
                                      ' // Retrieves a pointer to the IPersistFile interface
                                      hr = IUnknown_QueryInterface(psl, IID_IPersistFile, ppf)
                                      IF hr = %S_OK THEN
                                          ' // Retrieves an item identifier list specifying the desktop folder location
                                          hr = SHGetSpecialFolderLocation(%HWND_DESKTOP, csidl, pidl)
                                          IF hr = %NOERROR THEN
                                              ' // Retrieves the path from the item identifier list
                                              hr = SHGetPathFromIDList(BYVAL pidl, szFileName)
                                              ' // Frees the memory allocated for the item identifier list
                                              CoTaskMemFree pidl
                                              IF ISTRUE(hr) THEN
                                                  ' // Full path
                                                  szFileName = szFileName & "\" & szLinkName & ".LNK"
                                                  ' // Saves the shortcut file
                                                  [B]old = SetErrorMode(%SEM_FAILCRITICALERRORS)[/B]
                                                  hr  = IPersistFile_Save (ppf, szFileName, %TRUE)
                                                  [B]SetErrorMode old[/B]
                                              END IF
                                              FUNCTION = %TRUE
                                          END IF
                                          ' // Releases the IPersistFile interface
                                          IUnknown_Release ppf
                                      END IF
                                  
                                      ' // Releases the IShellLink interface
                                      IUnknown_Release psl
                                  END FUNCTION
                                  ' =======================================================================================
                                  
                                  ' =======================================================================================
                                  ' Main
                                  ' =======================================================================================
                                  FUNCTION PBMAIN
                                  LOCAL hr  AS LONG
                                  LOCAL fn  AS ASCIIZ * %MAX_PATH
                                  
                                      fn = "x:\test.exe"
                                  
                                      hr = CreateLink(%CSIDL_DESKTOP, "PB shortcut", fn, "My Arguments", CURDIR$, %SW_NORMAL, "My comment")
                                  
                                      IF ISFALSE (hr)THEN
                                          MSGBOX "CreateLink failed"
                                      END IF
                                  
                                  END FUNCTION

                                  Comment

                                  Working...
                                  X