PIF are useful for 9x only.
If you want to start 'correctly' PB/CC module under NT/2k/XP, create LNK and prepare a special section in registry (there are samples on BBS, so I don't post similar code here).
Test sample (PBWIN) for LNK and PIF (use own settings !)
------------------
If you want to start 'correctly' PB/CC module under NT/2k/XP, create LNK and prepare a special section in registry (there are samples on BBS, so I don't post similar code here).
Test sample (PBWIN) for LNK and PIF (use own settings !)
Code:
#Compile Exe #Dim All #Register None #Include "Win32Api.Inc" #Include "Lnk.Inc" #Include "Pif.Inc" '========================= SpecialFolder ======================== %CSIDL_TASKBAR = &H1000 Function SpecialFolder (ByVal CSIDL As Dword, Optional ByVal DontAddBackSplash As Dword) As String Local TmpAsciiz As Asciiz * %MAX_PATH Local ValueType As Dword Local hKey As Dword Local ValueName As Asciiz * 16 If CSIDL = %CSIDL_WINDOWS Then If GetWindowsDirectory (TmpAsciiz, SizeOf(TmpAsciiz)) Then Function = TmpAsciiz ElseIf CSIDL = %CSIDL_SYSTEM Then If GetSystemDirectory (TmpAsciiz, SizeOf(TmpAsciiz)) Then Function = TmpAsciiz Else If CSIDL = %CSIDL_PROGRAM_FILES Then If RegOpenKeyEx(%HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion", ByVal 0&, %KEY_READ, hKey) = %ERROR_SUCCESS Then _ ValueName = "ProgramFilesDir" ElseIf RegOpenKeyEx(%HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", ByVal 0&, %KEY_READ, hKey) = %ERROR_SUCCESS Then Select Case As Long CSIDL Case %CSIDL_STARTUP : ValueName = "StartUp" Case %CSIDL_DESKTOP : ValueName = "Desktop" Case %CSIDL_PROGRAMS : ValueName = "Programs" Case %CSIDL_PERSONAL : ValueName = "Personal" Case %CSIDL_MYPICTURES: ValueName = "My Pictures" Case %CSIDL_STARTMENU : ValueName = "Start Menu" Case %CSIDL_FAVORITES : ValueName = "Favorites" Case %CSIDL_APPDATA, %CSIDL_TASKBAR : ValueName = "AppData" End Select End If If ValueName = "" Then ElseIf RegQueryValueEx (hKey, ValueName, ByVal 0&, ValueType, TmpAsciiz, SizeOf(TmpAsciiz)) <> %ERROR_SUCCESS Then ElseIf ValueType = %REG_SZ Then If CSIDL = %CSIDL_TASKBAR Then If Right$(TmpAsciiz, 1) <> "\" Then TmpAsciiz = TmpAsciiz + "\" TmpAsciiz = TmpAsciiz + "Microsoft\Internet Explorer\Quick Launch" End If If DontAddBackSplash = 0 Then If Right$(TmpAsciiz, 1) <> "\" Then TmpAsciiz = TmpAsciiz + "\" Function = TmpAsciiz End If If hKey Then RegCloseKey hKey End If End Function '================ Change me ==================================== $LnkTitle = "PB 7.0 shortcut" $LnkExePath = "D:\Ltr.00\Bas32\Ltr32.Exe" $LnkCmdLine = "My Arguments" $LnkWorkDir = "D:\Ltr.02\Release\Bas32" $LnkIconPath = "E:\Windows\Explorer.Exe" %LnkIconIdx = 3 %LnkShowCmd = %SW_MAXIMIZE $LnkComment = "My comment" $PIFTitle1 = "PB 7.0 PIF (Var.1)" $PIFTitle2 = "PB 7.0 PIF (Var.2)" $PIFExePath = "C:\Ltr\Ltr.02J\Ltr.Exe" $PIFCmdLine = "My Arguments" $PIFWorkDir = "C:\Ltr\Ltr.02J" $PIFIconPath = "E:\Windows\Explorer.Exe" %PIFIconIdx = 3 $PIFWindowTitle = "My PB/CC program" %PIFFullscreen1 = 0 ' in window %PIFFullscreen2 = 1 ' full screen %PIFFontType1 = 0 ' bitmap %PIFFontType2 = 1 ' truetype %PIFFntWidth = 10 %PIFFntHeight = 18 Function PbMain CoInitialize ByVal 0 If CreateLink (SpecialFolder(%CSIDL_DESKTOP) + $LnkTitle + ".Lnk", $LnkExePath, $LnkCmdLine, $LnkWorkDir, _ $LnkIconPath, %LnkIconIdx, %LnkShowCmd, $LnkComment) = 0 Then MsgBox "Error 1" If CreateLink (SpecialFolder(%CSIDL_PROGRAMS) + $LnkTitle + ".Lnk", $LnkExePath, $LnkCmdLine, $LnkWorkDir, _ $LnkIconPath, %LnkIconIdx, %LnkShowCmd, $LnkComment) = 0 Then MsgBox "Error 2" If CreateLink (SpecialFolder(%CSIDL_TASKBAR) + $LnkTitle + ".Lnk", $LnkExePath, $LnkCmdLine, $LnkWorkDir, _ $LnkIconPath, %LnkIconIdx, %LnkShowCmd, $LnkComment) = 0 Then MsgBox "Error 3" If CreatePIF (SpecialFolder(%CSIDL_DESKTOP) + $PIFTitle1 + ".PIF", $PIFExePath, $PIFCmdLine, $PIFWorkDir, _ $PIFIconPath, %PIFIconIdx, $PIFWindowTitle, %PIFFullScreen1, %PIFFontType1, %PIFFntWidth, %PIFFntHeight) = 0 Then MsgBox "Error 4" If CreatePIF (SpecialFolder(%CSIDL_DESKTOP) + $PIFTitle2 + ".PIF", $PIFExePath, $PIFCmdLine, $PIFWorkDir, _ $PIFIconPath, %PIFIconIdx, $PIFWindowTitle, %PIFFullScreen2, %PIFFontType2, %PIFFntWidth, %PIFFntHeight) = 0 Then MsgBox "Error 5" SHChangeNotify %SHCNE_ALLEVENTS, %SHCNF_FLUSH, ByVal 0, ByVal 0 CoUninitialize MsgBox "Done" End Function
------------------
Comment