General discussion

Locked

Windows Path + Creating Shortcut

By kherad ·
Hi. I want to develop an installer program (something like installshield) you know? I want to know how it's possible to get windows path and how I can create shortcut. Is there any references? I can't wait to hear from you.

Regards, Ali

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Windows Path + Creating Shortcut

by tclere In reply to Windows Path + Creating S ...

If you are using VB you can use fCreateShellLink() from VB5STKIT.DLL

This test sample uses a network path
\\H4MWN. You can also use C:\MyDir

'<>
' This program creates a shortcut on the users desktop.
' NOTE: The file VB5STKIT.DLL must be present
'<>Option Explicit

Private Declare Function fCreateShellLink Lib "Vb5stkit.dll" (ByVal _
lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal _
lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As Long

Sub Main()
Dim lReturn As Long
Dim sDeskName As String
Dim sLinkDesc As String
Dim sLinkPath As String
Dim sLinkArgs As String
On Error GoTo ErrHndlr
'Add to Desktop
sDeskName = "..\..\Desktop"
sLinkDesc = "Shortcut to TestDoc"
sLinkPath = "\\h4mwn\develop\temp\test.doc"
sLinkArgs = ""

lReturn = fCreateShellLink(sDeskName, sLinkDesc, sLinkPath, sLinkArgs)

If

Collapse -

Windows Path + Creating Shortcut

by kherad In reply to Windows Path + Creating S ...

The question was auto-closed by TechRepublic

Collapse -

Windows Path + Creating Shortcut

by tclere In reply to Windows Path + Creating S ...

Looks like my solution was cut off. Here is the rest of it.

If lReturn = 1 Then
MsgBox "The ShortCut has been added to your Desktop!"
Else
MsgBox "I think there was an error creating the shortcut?"
End If
EndErrHndlr:
sDeskName = "Error No: " & Err.Number & Chr(10) & "Error Desc: " & Err.Description
Err.Clear
MsgBox sDeskName
End
End Sub

Collapse -

Windows Path + Creating Shortcut

by kherad In reply to Windows Path + Creating S ...

The question was auto-closed by TechRepublic

Collapse -

Windows Path + Creating Shortcut

by igp In reply to Windows Path + Creating S ...

I don't know what language do you want. So now wrote it with Delphi.

Here is answer for WinPath (function)

function GetWindowsFolder:string;
var
TR:TRegIniFile;
HK: HKEY;
begin
RegCreateKey(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows',HK);
Reg:=TRegIniFile.Create('');
Reg.RootKey:=HK;
GetWinVersion:=Reg.ReadString('CurrentVersion','SystemRoot','');
Reg.Free;
end;

Answer about ShellLink I sent to your e-mail (non-visual component).

If you want I can translate it to API.

Collapse -

Windows Path + Creating Shortcut

by kherad In reply to Windows Path + Creating S ...

The question was auto-closed by TechRepublic

Collapse -

Windows Path + Creating Shortcut

by kherad In reply to Windows Path + Creating S ...

This question was auto closed due to inactivity

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums