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.
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 = ""
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
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're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Windows Path + Creating Shortcut
Regards, Ali