AutoItQuest Posted July 30, 2010 Share Posted July 30, 2010 My projekt is an simply WinPE enviroment with some copy processes. The assigment between file and application do not work like Windows Explorer. I have read all ideas to resolve the problem such as SH**, **Extract** but no one resolved my problem. Can anybody help me to show the right icon for file? In most of all cases it works but not in all. XXCopy is an xcopy with Gui. Override is an include. Start it from DOS shell. AutoIt Version v3.3.4.0XXCopy.au3Override.au3 Link to comment Share on other sites More sharing options...
doudou Posted July 31, 2010 Share Posted July 31, 2010 The assigment between file and application do not work like Windows Explorer. I have read all ideas to resolve the problem such as SH**, **Extract** but no one resolved my problem. Can anybody help me to show the right icon for file? At first glance I didn't find the spot in your code, where you try to show file icons (and honestly, I don't have the time to look more intensively). However, the easiest way to achieve this would be: expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> Global Const $SS_REALSIZEIMAGE = 0x00000800 Global Const $SS_ENDELLIPSIS = 0x00004000 Global Const $SS_PATHELLIPSIS = 0x00008000 Global Const $SS_WORDELLIPSIS = 0x0000C000 Global Const $SS_ELLIPSISMASK = 0x0000C000 Global Const $STM_SETIMAGE = 0x0172 Global Const $STM_GETIMAGE = 0x0173 Global Const $SHGFI_ICON = 0x00000100 ; get icon Global Const $SHGFI_DISPLAYNAME = 0x00000200 ; get display name Global Const $SHGFI_TYPENAME = 0x00000400 ; get type name Global Const $SHGFI_ATTRIBUTES = 0x00000800 ; get attributes Global Const $SHGFI_ICONLOCATION = 0x00001000 ; get icon location Global Const $SHGFI_EXETYPE = 0x00002000 ; return exe type Global Const $SHGFI_SYSICONINDEX = 0x00004000 ; get system icon index Global Const $SHGFI_LINKOVERLAY = 0x00008000 ; put a link overlay on icon Global Const $SHGFI_SELECTED = 0x00010000 ; show icon in selected state Global Const $SHGFI_ATTR_SPECIFIED = 0x00020000 ; get only specified attributes Global Const $SHGFI_LARGEICON = 0x00000000 ; get large icon Global Const $SHGFI_SMALLICON = 0x00000001 ; get small icon Global Const $SHGFI_OPENICON = 0x00000002 ; get open icon Global Const $SHGFI_SHELLICONSIZE = 0x00000004 ; get shell size icon Global Const $SHGFI_PIDL = 0x00000008 ; pszPath is a pidl Global Const $SHGFI_USEFILEATTRIBUTES = 0x00000010 ; use passed dwFileAttribute Global Const $SHGFI_ADDOVERLAYS = 0x00000020 ; apply the appropriate overlays Global Const $SHGFI_OVERLAYINDEX = 0x00000040 ; Get the index of the overlay in the upper 8 bits of the iIcon Global Const $_SFI_HICON = 0 Global Const $_SFI_IICON = 1 Global Const $_SFI_DWATTRIBUTES = 2 Global Const $_SFI_SZDISPLAYNAME = 3 Global Const $_SFI_SZTYPENAME = 4 Global Const $_SFI_MAX = 5 Global Const $tagSHFILEINFO = 'ptr hIcon;' & _ 'int iIcon;' & _ 'dword dwAttributes;' & _ 'wchar szDisplayName[260];' & _ 'wchar szTypeName[80]' GUICreate("Icon", 100, 100, (@DesktopWidth - 100) / 2, (@DesktopHeight - 100) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CAPTION)) Global $ico = GUICtrlCreateIcon("", -1, 34, 34, 32, 32, BitOR($SS_ICON,$SS_NOTIFY,$SS_REALSIZEIMAGE,$WS_GROUP,$WS_VISIBLE,$WS_CHILD)) ShowIcon("C:\WINDOWS\explorer.exe") GUISetState() ;Show GUI While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() Func ShowIcon($path) Local $f = BitOr($SHGFI_TYPENAME, $SHGFI_DISPLAYNAME, $SHGFI_ICON, $SHGFI_LARGEICON) If Not FileExists($path) Then $f = BitOR($f, $SHGFI_USEFILEATTRIBUTES) Local $sfi[5] = [0, 0, 0, "", ""] Local $hIml = _ShellAPI_SHGetFileInfo($path, $sfi, $f) If $hIml And $sfi[$_SFI_HICON] Then GUICtrlSendMsg($ico, $STM_SETIMAGE, $IMAGE_ICON, $sfi[$_SFI_HICON]) EndIf EndFunc Func _ShellAPI_SHGetFileInfo($pszPath, ByRef $infoArray, $uFlags, $dwFileAttributes = $FILE_ATTRIBUTE_NORMAL) Local $sfi = DllStructCreate($tagSHFILEINFO) Local $result = DllCall( "shell32.dll", "ulong_ptr", "SHGetFileInfoW", _ "wstr", $pszPath, "dword", $dwFileAttributes, _ "ptr", DllStructGetPtr($sfi), "uint", DllStructGetSize($sfi), _ "uint", $uFlags ) If @error Then SetError(@error, 0, 0) Else If $_SFI_MAX > UBound($infoArray) Then ReDim $infoArray[$_SFI_MAX] $infoArray[$_SFI_HICON] = DllStructGetData($sfi, "hIcon") $infoArray[$_SFI_IICON] = DllStructGetData($sfi, "iIcon") $infoArray[$_SFI_DWATTRIBUTES] = DllStructGetData($sfi, "dwAttributes") $infoArray[$_SFI_SZDISPLAYNAME] = DllStructGetData($sfi, "szDisplayName") $infoArray[$_SFI_SZTYPENAME] = DllStructGetData($sfi, "szTypeName") EndIf $sfi = 0 Return $result[0] EndFunc UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE Link to comment Share on other sites More sharing options...
AutoItQuest Posted August 2, 2010 Author Share Posted August 2, 2010 Thanks very much Spammer. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 2, 2010 Share Posted August 2, 2010 Very funny Newbie. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
doudou Posted August 2, 2010 Share Posted August 2, 2010 Thanks very much Spammer.You are welcome. Call me doudou. Very funny Newbie.He is, truly. But it is funny, dear "The summer-heat is melting me brains". UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE Link to comment Share on other sites More sharing options...
trancexx Posted August 2, 2010 Share Posted August 2, 2010 Isn't this nice. Tranquility and stuff. I'm melting. ♡♡♡ . eMyvnE 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