maeldz Posted September 16, 2014 Share Posted September 16, 2014 how to load an splash image from executable's resource. Could someone show an example? Translated by google chrome Link to comment Share on other sites More sharing options...
Solution UEZ Posted September 16, 2014 Solution Share Posted September 16, 2014 (edited) Try this:#AutoIt3Wrapper_Res_File_Add="c:\Program Files (x86)\AutoIt3\Examples\GUI\logo4.gif", RT_RCDATA, GIF_1, 0 #include 'ResourcesEx.au3' #include <WindowsConstants.au3> #include <WinAPISys.au3> If Not @Compiled Then MsgBox($MB_SYSTEMMODAL, '', 'Please compile the example before running, as the resouces need to be added to the executable.') EndIf Global $hHBITMAP = _Resource_GetAsBitmap('GIF_1', $RT_RCDATA) If Not $hHBITMAP Then Exit MsgBox(0, "Error", "Unable to get resource as bitmap:" & @error, 10) Global $hGUI = _SplashImageOn("Test", $hHBITMAP) Sleep(2000) _WinAPI_AnimateWindow($hGUI, BitOR($AW_BLEND, $AW_HIDE)) GUIDelete($hGUI) _WinAPI_DeleteObject($hHBITMAP) Func _SplashImageOn($sTitle, $hGDIBitmap, $bAnimate = True, $iAnimFlag = $AW_BLEND, $iAnimDur = 1000, $iX = Default, $iY = Default, $iStyle = BitOR($WS_BORDER, $WS_POPUP), $iExStyle = $WS_EX_TOPMOST) ;coded by UEZ build 2014-09-16 Local $tDim = DllStructCreate($tagBITMAP) DllCall("gdi32.dll", 'int', 'GetObject', 'int', $hGDIBitmap, 'int', DllStructGetSize($tDim), 'ptr', DllStructGetPtr($tDim)) If @error Then Return SetError(1, 0, 0) Local Const $iW = $tDim.bmWidth, $iH = $tDim.bmHeight Local Const $hGUI = GUICreate($sTitle, $iW, $iH, $iX, $iY, $iStyle, $iExStyle) Local Const $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH) _Resource_SetBitmapToCtrlID($iPic, $hGDIBitmap) Switch $bAnimate Case False GUISetState(@SW_SHOW, $hGUI) Case Else _WinAPI_AnimateWindow($hGUI, $iAnimFlag, $iAnimDur) EndSwitch Return $hGUI EndFuncAdjust the paths accordingly. ResourceEx can be found here: '?do=embed' frameborder='0' data-embedContent>> Br,UEZ Edited September 16, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
maeldz Posted September 16, 2014 Author Share Posted September 16, 2014 Thank you man, you're the best. It worked perfectly.Translated by google translate Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now