Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make programmatically a desktop link 1

Status
Not open for further replies.

VictorFRodriguez

Programmer
Jan 20, 2001
51
DO
I would like to install an application and want to include in it the link to where it is installed. I used VFP6.
Victor F. Rodriguez
 
Are you using InstallShield Express to install your app? If so, its really simple to use the ISX interface to specify the shortcut on the desktop.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
I have neved used InstallShield...
But I will try. But I am of those persons that like to do things with my fingers, with code...
Do you know a code for that?
Victor
 
I know that it is very difficult to do through code.

The old VB Setup creator thingy came with a DLL which had a function just to create shortcuts. It seems that there is no API in windows itself that can do this... and different shortcuts have different formats depending on whether they are shortcuts to DOS programs, Windows programs, Folders, URLs, "Advertised" programs, etc., and the formats are not documented.

If you are willing to require Windows Scripting Host, there is a method in the FileSystemObject that can create shortcuts: but the WSH is not a standard windows component... many Admin's remove it because of all the security holes it enables.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Here's a way to create a shortcut.... in C:

However, most C code can be converted to VFP... I started to try, and it's pretty difficult for me to decipher all the macros used in this code. This is as far as I got:
Code:
  #DEFINE CLSCTX_INPROC_SERVER 0x1
  CLSID_ShellLink = '{00021401-0000-0000-C000-000000000046}'
  IID_IShellLink = '{000214EE-0000-0000-C000-000000000046}'
  ipShellLink = 0

  DECLARE LONG CoCreateInstance IN ole32.dll ;
    STRING @ REFCLSID_rclsid, ;
    LONG LPUNKNOWN_pUnkOuter, ;
    LONG DWORD_dwClsContext,  ;
    STRING @ REFIID_riid,         ;
    LONG @ LPVOID_ppv

  hRes = CoCreateInstance( CLSID_ShellLink, 0, 1, ;
                           IID_IShellLink, ;
                           @ipShellLink)

However, hRes always returns -2147221164, which, in hex using TRANSFORM(hRes,'@0'), is 0x80040154, which, if you search in WINERROR.H, translates to: REGDB_E_CLASSNOTREG, MessageText: Class not registered.

I can't figure out what I'm doing wrong.... but without getting the class instance, you can't go any further....

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
This is what I was looking for... Thanks Mark Lewis and all those who paid attention to this...
Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top