Announcement

Collapse
No announcement yet.

Writing a short-cut to the desktop

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

  • Writing a short-cut to the desktop

    Hi, people of the PB entrapment's...

    We all know the an easy way to put a shortcut on the desktop is to go to the file folder, of that file, and right click it... pick 'make shortcut'... and drag it to the desktop... Presto... It's there...
    On the disk the user purchases, from me, I send them a shortcut file they can drag and drop, if they desire... I read that Power Basic doesn't support any wild card symbols, such as the * or ?...
    So to write a file with any address of C:\user\?\desktop\file name, can not be used... Where the question mark (?) is the name the user has for the computer, and only the user and hackers can know or find out... Not being a hacker, (Not a very good one, anyway) how do I address that bump...
    Remember that you are also telling all the people that monitor all the answers of the forum, and who are also learning, you are doing a good thing... Sort of private tutoring...
    I have never encountered a more helpful group of people willing to give their time and effort, than you people... I thank you for that...

    Izzy

  • #2
    If you need to get correct location for the Desktop.

    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "Win32api.inc"
    
    FUNCTION PBMAIN () AS LONG
        ? DesktopFldr
    END FUNCTION
    
    FUNCTION DesktopFldr() AS STRING
    LOCAL lngPidlFound AS LONG
    LOCAL lngFolderFound AS LONG
    LOCAL lngPidl AS LONG
    LOCAL strPath AS ASCIIZ * %MAX_PATH
    
    lngPidlFound = SHGetSpecialFolderLocation(0, %CSIDL_DESKTOPDIRECTORY, lngPidl)
    IF lngPidlFound = %NOERROR THEN
        lngFolderFound = SHGetPathFromIDList(lngPidl, strPath)
        IF lngFolderFound THEN
            FUNCTION = strPath
        END IF
    END IF
    CoTaskMemFree lngPidl
    END FUNCTION
    To create shortcut to anywhere in code, see:
    https://forum.powerbasic.com/forum/u...752#post617752





    Comment


    • #3
      Using Jose's Includes
      Code:
      #COMPILE EXE
      #DIM ALL
      #INCLUDE "AfxShell.inc"
      
      FUNCTION PBMAIN () AS LONG
          ? AfxGetSpecialFolderLocation (%CSIDL_DESKTOPDIRECTORY)
      END FUNCTION 

      Comment


      • #4
        Stuart & Rod...

        Thanx for the response...
        When I get back from Philly I will try them out...

        Izzy

        Comment


        • #5
          If you are going to be distributing software "to be installed by user" you may want to look at a "setup" program.

          Lots of members - myself included - will tell you you can't go wrong with Inno Setup (http://www.jrsoftware.org/)

          Making a desktop shortcut - ASKING the user if he wants one or not, is only two lines of code in your script (commented script==>
          Inno Setup:Commented Installation Script June 8 2003

          (For some reason I did not include those lines in that demo so here they are .

          Code:
          [TASKS]
          ; Does user want a desktop icon?
          Name: desktopicon; Description: "Create a &desktop icon"
          ...
          [Icons]
          .....
          ; desktop icon only on demand:
          Name: "{commondesktop}\Provider Payment Partner System 4.0";Filename: "{app}\system\ppps.exe"; workingdir:"{app}"; Tasks:desktopicon
          'Tasks' provide a screen with a checkbox for the user to check or uncheck during the install... the "icons" command executes only if the user has checked that option.

          Handles all the "find the directory" stuff for you.


          MCM






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

          Comment


          • #6
            I already have a SETUP Program on the disk...
            It is this...
            Code:
            #COMPILE EXE
            
            #DIM ALL
            #INCLUDE "Win32API.inc"
            
            FUNCTION PBMAIN () AS LONG
            
            LOCAL C AS LONG
            
            MKDIR "C:\CHIXMATH"
            SLEEP 1
            FILECOPY "CHIXKIDZMATH.EXE","C:\ChixMath\ChixKidzMath.exe"
            SLEEP 1
            FILECOPY "CHIXKIDZDIVISION.EXE","C:\ChixMath\ChixKidzDivision.exe"
            SLEEP 1
            FILECOPY "CHIXKIDZFRACTIONS.EXE","C:\ChixMath\ChixKidzFractions.exe"
            SLEEP 1
            FILECOPY "CHIXKIDZFRACTIONTUTORIAL.EXE","ChixMath\ChixKidzFractionsIutorial.exe"
            SLEEP 1
            FILECOPY "READFIRST.EXE","C:ChixMath\ReadFirst.exe"
            SLEEP 1
            
            END FUNCTION
            It makes a directory and copies the files to that directory...
            I also have a 'drop & drag' to the desktop shortcut file that simply is this...
            C:\CHIXMATH\ChixKidzMath.exe
            Once there, double clicking launches the Math Program...
            Instead of them having to Drag & Drop the file, from the disk in the 'D' Drive, I wanted the SetUp Program to put it there...

            I will try the above suggestions to see if I can get that done...

            Izzy

            Comment


            • #7
              Super Hidden File Extensions
              Even when you have configured Windows to display all file extensions, there are still some which remain hidden.
              Shortcuts fall in that category.

              To copy the Shortcut from your install drive D, you will need to include the ".lnk" that is an ".LNK"

              something like this.
              Code:
              #COMPILE EXE
              #DIM ALL
              #INCLUDE "AfxShell.inc"
              
              FUNCTION PBMAIN () AS LONG
                  FILECOPY "ChixKidzMath.exe - Shortcut.lnk", AfxGetSpecialFolderLocation (%CSIDL_DESKTOPDIRECTORY) + "\ChixKidzMath.exe - Shortcut.lnk"
              END FUNCTION  
              Again, this is using Jose Roca's Includes. https://forum.powerbasic.com/forum/j...ers-iii-v-1-07
              Last edited by Rod Macia; 19 Jul 2016, 08:04 PM.

              Comment


              • #8
                Thanx, Rod...

                We all know that Jose is the 'Man' when it comes to Power Basic Anything... I am on my way to Philly...
                See you all when I get back... Not taking a computer... Absolutely no distractions...

                Izzy

                Comment

                Working...
                X