#3907 closed Bug (Fixed)

#AutoIt3Wrapper_Res_File_Add not supporting UNC path for ICO file

Reported by: mychaelsoft Owned by: Jos
Milestone: Component: SciTE4AutoIt
Version: Severity: None
Keywords: Cc:


Thank you for this amazing community! I have been able to make #AutoIt3Wrapper_Res_File_Add work using a local path, but not a network path. By contrast, #AutoIt3Wrapper_Res_Icon_Add seems fine with UNC paths, though not shown in the sample below.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Icon_Add=\\FILESERVER\Scripts\Resources\DCL_53x53_16.ico,8 ;works fine
#AutoIt3Wrapper_Res_File_Add=\\FILESERVER\Scripts\Resources\DCL_53x53_16.ico, rt_rcdata, DCL_LOGO_ICON ; does not work
;#AutoIt3Wrapper_Res_File_Add=C:\Users\mike\OneDrive - Dav Ctl\Pictures\DCL_53x53_16.ico, rt_rcdata, DCL_LOGO_ICON  ; works fine
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include "\\FILESERVER\Scripts\Include\ResourcesEx.au3"
#include <GuiConstants.au3>
#include <WinAPIConstants.au3>

Global $hSplashlogoImage = 0
If @Compiled Then $hSplashlogoImage = _Resource_GetAsImage("DCL_LOGO_ICON") ; If exe, use Resource. Otherwise, refer to _GDIPlus_BitmapCreateFromFile
_SplashGUILogoButton(100, 100)
Sleep (3000)

Func _SplashGUILogoButton($LogoHorizontalPos, $LogoVerticalPos)
        $hSplashGUILogo = GUICreate("SplashGUILogo", 16, 16, $LogoHorizontalPos, $LogoVerticalPos, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
        If Not @Compiled Then
                Local $hImage = _GDIPlus_BitmapCreateFromFile("C:\Users\mike\OneDrive - Dav Ctl\Pictures\DCL_53x53_16.BMP")
                $hSplashlogoImage = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
        _SetBitmap($hSplashGUILogo, $hSplashlogoImage, 255, 16, 16)     ; DCL dog icon
        $hBack = GUICtrlCreateLabel("", 0, 0, 16, 16)   ; empty label control
        GUICtrlSetState(-1, $gui_disable)
        GUISetState(@SW_SHOWNA, $hSplashGUILogo)
        Return ($hSplashGUILogo)
EndFunc   ;==>_SplashGUILogoButton

Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 200, $n_height = 200) ; To support _$hSplashGUILogo
        Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
        $hScrDC = _WinAPI_GetDC(0)
        $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
        If Not @Compiled Then $hImage = _GDIPlus_BitmapCreateFromFile("C:\Users\mike\OneDrive - Dav Ctl\Pictures\DCL_53x53_16.BMP")
        $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
        $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
        $tSize = DllStructCreate($tagSIZE)
        $pSize = DllStructGetPtr($tSize)
        DllStructSetData($tSize, "X", $n_width)
        DllStructSetData($tSize, "Y", $n_height)
        $tSource = DllStructCreate($tagPOINT)
        $pSource = DllStructGetPtr($tSource)
        $tBlend = DllStructCreate($tagBLENDFUNCTION)
        $pBlend = DllStructGetPtr($tBlend)
        DllStructSetData($tBlend, "Alpha", $iOpacity)
        DllStructSetData($tBlend, "Format", 1)
        _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
        _WinAPI_ReleaseDC(0, $hScrDC)
        _WinAPI_SelectObject($hMemDC, $hOld)
EndFunc   ;==>_SetBitmap

Attachments (0)

Change History (3)

comment:1 Changed 19 months ago by Jos

  • Status changed from new to assigned

Confirmed ... will have a look.


comment:2 Changed 19 months ago by Jos

Will be fixed in the next version. When you like to test the fix, just comment these lines in Func _Compile_Upd_res($ScriptFile_Out) as those shouldn't be there:

			For $x = 1 To $INP_Res_Files_Cnt
				$ResFileInfo = StringSplit($INP_Res_Files[$x], ",")
				ReDim $ResFileInfo[5]
				If $ResFileInfo[2] = "" Then $ResFileInfo[2] = $RT_MESSAGETABLE
				If $ResFileInfo[3] = "" Then $ResFileInfo[3] = $x
				If $ResFileInfo[4] = "" Then $ResFileInfo[4] = $INP_Res_Language
; removed as it makes the UNC fail and seems to be unnecessary
;~ 				$ResFileInfo[1] = StringReplace($ResFileInfo[1], "\", "\\")
;~ 				$ResFileInfo[1] = StringReplace($ResFileInfo[1], "/", "\\")
				$Res_Update_cnt += _Res_Update($rh, StringStripWS($ResFileInfo[1], 3), StringStripWS($ResFileInfo[2], 3), StringStripWS($ResFileInfo[3], 3), StringStripWS($ResFileInfo[4], 3))

comment:3 Changed 19 months ago by Jos

  • Resolution set to Fixed
  • Status changed from assigned to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Jos.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.