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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Icons LNK Start Programs ME

Status
Not open for further replies.

dgschnei

Technical User
Nov 26, 2002
14
US
I use OSfCreateShellLink in my VB program to create icons link in Start>Programs and in immediate subfolders.

fSuccess = OSfCreateShellLink(strGroupName, strLinkName, strLinkPath, strLinkArguments, fPrivate, sParent)

It works fine on Windows 2000 and XP; all the icons get created fine.

But I cannot get it to work on Windows ME.

Do I have to pass the values differently for Windows ME?

Is there anything else I have to use to create icons (lnk) on ME? (on ME I can create the Start Program subfolders but not the icons).

On Windows ME the function OSfCreateShellLink does not even seem to return a fSuccess value but seems to go right into error. That is why I am asking if I should pass the values differently for Windows ME?

Any help is welcomed.

FYI:

'-----------------------------------------------------------
' SUB: CreateShellLink
'
' Creates (or replaces) a link in either Start>Programs or
' any of its immediate subfolders in the Windows 95 shell.
'
' IN: [strLinkPath] - full path to the target of the link
' Ex: 'c:\Program Files\My Application\MyApp.exe"
' [strLinkArguments] - command-line arguments for the link
' Ex: '-f -c "c:\Program Files\My Application\MyApp.dat" -q'
' [strLinkName] - text caption for the link
' [fLog] - Whether or not to write to the logfile (default
' is true if missing)
'
' OUT:
' The link will be created in the folder strGroupName
'-----------------------------------------------------------
Public Declare Function OSfCreateShellLink Lib "vb6stkit.dll" Alias "fCreateShellLink" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArguments As String, ByVal fPrivate As Long, ByVal sParent As String) As Long

Dominique G. Schneider
 
I got it to work on ME by using:

Public Declare Function fCreateShellLink Lib "vb5stkit.dll" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArguments As String) As Long

fSuccess = fCreateShellLink(strGroupName, strLinkName, strLinkPath, strLinkArguments)

=============================

I got it to work on XP/2000 by using:

Public Declare Function fCreateShellLink Lib "vb6stkit.dll" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArguments As String, ByVal fPrivate As Long, ByVal sParent As String) As Long

fSuccess = fCreateShellLink(strGroupName, strLinkName, strLinkPath, strLinkArguments, fPrivate, sParent)

=============================

vb5stkit.dll and vb6stkit.dll do not take the same number of arguments

It is understood that only one Function named fCreateShellLink can be declared in the VB project.

Is there any way I can bypass this dilemma? Any help is welcomed.


Dominique G. Schneider
 
For the people that may be interested by such need to create shortcuts, as far as I know I resolved the creation of shortcuts on Win98 / ME / 2000 / XP by using in my VB utility ShellLink.CLS and ShellLink.BAS and I also referenced ShellLink.TLB.

Then I use in the code:
Dim MyObj As New cShellLink
lReturn = MyObj.CreateShellLink(.............)


Outlined description of utility:

The shortcut strings come from an INI (localized if desired in Russian, French, Spanish, Italian, German, Japanese, Chinese...).
I use the GetSpecialFolder function to obtain the localized name of Start Menu and Programs.

I compiled the VB project into an EXE.

I deliver the EXE and the localized INI.

As far as I know, I tested this on ME / 2000 / XP in 3 different languages English. French, Russian.

It seems to work…


Dominique G. Schneider
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top