Me = 1 vs MVPs/Mod = 0, this time and maybe only this time i have the ANSWER
Yeah is not a competition but it is a satisfaction
;~ ;johnmcloud - 2014
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
;~ Global Const $tagSTARTUPINFO = "int Size;ptr Reserved1;ptr Desktop;ptr Title;int X;int Y;int XSize;int YSize;int XCountChars;" & _
;~ "int YCountChars;int FillAttribute;int Flags;short ShowWindow;short Reserved2;ptr Reserved3;int StdInput;" & _
;~ "int StdOutput;int StdError"
Global $sState = @SW_SHOW
Global $sShortcut = _RunFromShortcut()
If IsArray($sShortcut) Then
If $sShortcut[6] = 3 Then $sState = @SW_SHOWMAXIMIZED
If $sShortcut[6] = 7 Then $sState = @SW_SHOWMINIMIZED
EndIf
$hGUI = GUICreate("Johnmcloud knows best", 265, 250, -1, -1, $WS_MAXIMIZEBOX)
_WinAPI_ShowWindow($hGUI, $sState) ;@SW_SHOWMAXIMIZED with GUISetState not work
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _RunFromShortcut()
Local $tSI = DllStructCreate($tagSTARTUPINFO)
DllCall('kernel32.dll', 'none', 'GetStartupInfoW', 'struct*', $tSI)
If @error Then Return SetError(@error, @extended, 0)
Local $vFlag = DllStructGetData($tSI, 'Flags')
If BitAND($vFlag, 0x800) Then
Local $sTitle = DllStructCreate('wchar ShortcutPath[261]', DllStructGetData($tSI, 'Title'))
Local $sShortcutPath = DllStructGetData($sTitle, 'ShortcutPath')
If $sShortcutPath Then
Return FileGetShortcut($sShortcutPath)
Else
Return SetError(1, 0, 0)
EndIf
Else
Return SetError(2, 0, 0)
EndIf
EndFunc ;==>_Shortcut