#include <StructureConstants.au3>
$sShortcut = _Start_Shortcut()
If @error Then
MsgBox(16, 'Error', 'Error')
Exit
Else
If $sShortcut Then
MsgBox(64, 'Info', 'Процесс запущен ярлыком' & @LF & 'Путь к нему: ' & $sShortcut)
Else
MsgBox(64, 'Info', 'Процесс запущен' & @LF & 'не ярлыком')
EndIf
EndIf
Func _Start_Shortcut()
Local $t_Startup, $b_Flag, $STARTF_TITLESHORTCUT = 0x800, $iMAX_PATH = 260, $t_Title, $s_ShortcutPath
$t_Startup = DllStructCreate($tagSTARTUPINFO)
DllStructSetData($t_Startup, 'Size', DllStructGetSize($t_Startup))
DllCall('kernel32.dll', 'none', 'GetStartupInfoW', 'ptr', DllStructGetPtr($t_Startup))
If @error Then Return SetError(1, 0, -1)
$b_Flag = DllStructGetData($t_Startup, 'Flags')
If BitAND($b_Flag, $STARTF_TITLESHORTCUT) Then
$t_Title = DllStructCreate('wchar ShortcutPath[' & $iMAX_PATH + 1 & ']', DllStructGetData($t_Startup, 'Title'))
$s_ShortcutPath = DllStructGetData($t_Title, 'ShortcutPath')
If $s_ShortcutPath Then
Return SetError(0, 0, $s_ShortcutPath)
Else
Return SetError(1, 0, -1)
EndIf
Else
Return SetError(0, 0, 0)
EndIf
EndFunc ;==>_Start_Shortcut