AutoHotkey Community

It is currently May 26th, 2012, 12:53 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: December 24th, 2008, 6:07 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
scottmattes wrote:
found something, there are 4 buttons above the status bar.


That was the intended effect. Use the humble Accelerator Keys feature of Buttons in lieu of Hotkeys. I did not want to waste the Gui Real-Estate though, hence keep them outside the viewable client area

Quote:
I was experimenting with sizing


Oh, in that case you could place the buttons above the viewable client area, like
Gui, Add, Button, x5 w100 y-20 h20

Here is a working demo - resizable window with non-viewable buttons

Code:
Gui +Resize
Gui, Margin, 5, 5
Gui, Add, Button, x5  w100 y-20 h20 gConvertCase, &Upper
Gui, Add, Button, x+5 yp w100 h20   gConvertCase, &Lower
Gui, Add, Button, x+5 yp w100 h20   gConvertCase, &Proper
Loop 24
 Str .= "The Quick Brown Fox Jumps Over The Lazy Dog`n"
Gui, Add, Edit, x5 y+5 w320 h240 vMyEdit, %Str%
Gui, Show
Return

ConvertCase:
 GuiControlGet, MyEdit
 IfEqual,A_GuiControl,&Upper,  StringUpper, MyEdit, MyEdit
 IfEqual,A_GuiControl,&Lower,  StringLower, MyEdit, MyEdit
 IfEqual,A_GuiControl,&Proper, StringUpper, MyEdit, MyEdit, T
 GuiControl,, MyEdit, %MyEdit%
Return

GuiSize:
 GuiW:=A_GuiWidth, GuiH:=A_GuiHeight
 SetTimer, SizeControls, -50
Return

SizeControls:
 GuiControl, MoveDraw, MyEdit, % "x5 y5 w" GuiW-10 " h" GuiH-10
Return


Run above code and use
Alt+U to convert case to Upper
Alt+L to convert case to Lower
Alt+P to convert case to Proper


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 24th, 2008, 3:07 pm 
Offline

Joined: May 21st, 2007, 3:44 pm
Posts: 176
Location: USA
SKAN,
If I change the 'where' of the buttons, I'd still have to put the 'resize' on the 'gui, show' so that it would accommodate all parts of all controls, right?

I like seeing the buttons because at my advanced age it is hard to remember all the keys to use in all the programs that i use :)

Thank you for the resize demo!

_________________
-------------
Scott Mattes
Image
My small, and slowly growing, collection of scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 25th, 2008, 10:59 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
Sup SKAN... any word on the beta?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2008, 3:32 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
@vixay

Select an Icon in IconView and press <F10>

Code:
; IconEx v1.2b by SKAN ( arian.suresh@gmail.com )  ||   CD: 13-May-2008 |  LM: 27-Dec-2008
DllCall( "LoadLibrary", Str,"Shell32.dll")
#SingleInstance, Force
SetWorkingDir %A_ScriptDir% 
SetBatchLines, -1
Process, Priority,, High

SaveButton := 0x79 -1   ; ( VK code for F9 ) Note: modify -1 to -2 for F8 and so on...
KeyName := "F9"         ; depends on the VK code you use above
Deff    := A_ScriptDir  ; Default ICON save folder
CallB   := RegisterCallback( "EnumResNameProc" )
tFolder := A_WinDir "\SYSTEM32\SHELL32.DLL" ; default folder in address bar
IfExist, %A_Temp%\IconEx.tmp
 {
   FileRead, tFolder, %A_Temp%\IconEx.tmp
   FileDelete, %A_Temp%\IconEx.tmp   
 }
 
EnumResNameProc( hModule, lpszType, lpszName, lParam ) {
 Global IconGroups, IGCount
 IconGroups .= ( ( IconGroups!="" ) ? "|" : "" ) . lpszName , IGCount:=IGCount+1 
 Return True
}

Gui,Font, s10 Normal, Tahoma
; SHAutoComplete():  Sean - http://www.autohotkey.com/forum/viewtopic.php?p=121621#121621
; For constants : http://www.codeproject.com/KB/edit/autocomp.aspx
Gui, Add, Combobox, x7 y7 w550 h21 Choose1 -Theme hwndhSHAC vtFolder, %tFolder%
ControlGet, hMyEdit, hWnd,, Edit1, ahk_id %hSHAC%

DllCall( "ole32\CoInitialize", UInt,0 )
DllCall( "shlwapi\SHAutoComplete", UInt,hMyEdit, UInt,0x1|0x10000000 )
; DllCall( "ole32\CoUninitialize" ) ; In Vista: Crashes AHK On Exit
 
Gui,Font, s8 Normal, Tahoma
Gui, Add, Button, x+2 w33 h24 +Default gUpdateResourceList, &Go
Gui, Add, Button, x+2 w52 h24 gSelectFolder, &Browse
Gui, Add, ListView, x7 y+5 h280 w235 -Theme -E0x200 +0x4 +0x8 +Border vLVR gLVR 
                   +BackGroundFFFFFA c444466 AltSubmit, Resource File|Icons|IconGroup
LV_ModifyCol( 1 ,"170" ), LV_ModifyCol( 2, "42 Integer" ), LV_ModifyCol( 3, "0" )
Gui, Add, ListView, x+0 yp h280 w405 -Theme +Icon -E0x200 +0x100
                   +BackGroundFFFFFC cBB2222 Border AltSubmit vLVI gLVI hwndLVC2
Gui, Add, Hotkey, x2 y+79 w1 h1 +Disabled vHotkey gCreateSimpleIcon
Loop 8 {
   Ix += 1 
   Gui, Add, Text,x+10 yp-70 0x1203 w70 h70 vI%Ix% hWndIcon%Ix% gSelectSimpleIcon
   Gui, Add, Text, xp  yp+70 0x201  w70 h16 vIconT%Ix%, -

Gui, Add, Text, x2 y+79 w1 h1
Loop 8 {
   Ix += 1 
   Gui, Add, Text,x+10 yp-70 0x1203 w70 h70 vI%Ix% hWndIcon%Ix% gSelectSimpleIcon
   Gui, Add, Text, xp  yp+70 0x201  w70 h16 vIconT%Ix%, -


Gui, Add, Button, X7 y+30 gAccelerator, &File
Gui, Add, Button, x+5     gAccelerator, &Icon
Gui, Add, Button, x+5     gAccelerator, A&ddress Bar
Gui, Add, Button, x+5     gAccelerator, &Reload
Gui,Font
Gui, Add, StatusBar, vSB gFindTarget
SB_SetParts( 40,425 )
GoSub, UpdateResourceList
SB_SetText( "Type the path to a folder/file. Auto complete enabled", 2 )
Gui, Show, w655 h535 , IconEx - v1.0
Return                                                 ; // end of auto-execute section //

UpdateResourceList:
  SendInput, {Escape}
  ControlGetText,tFolder,, ahk_id %hSHAC%
  If ! InStr( FileExist( tFolder ), "D" ) 
    Folder := tFolder
  Else Folder := tFolder . "\*.*"
  GoSub, SetFolder
  Gui, ListView, LVI
  LV_Delete()
  Gui, ListView, LVR
  LV_Delete(), , SB_SetText( "  Loading files.. Please wait" , 2 ), FileCount := 0
  Loop, %Folder%  {
    If A_LoopFileExt Not in EXE,DLL,CPL,SCR
      Continue
    hModule := DllCall( "LoadLibraryEx", Str,A_LoopFileLongPath, UInt,0, UInt,0x2 )
    IfEqual,hModule,0,Continue
    IGCount:=0, IconGroups := ""
    DllCall("EnumResourceNamesA", UInt,hModule, UInt,14, UInt,CallB, UInt,0 )
    DllCall( "FreeLibrary", UInt,hModule )
    IfEqual,IGCount,0, Continue
    FileCount:=FileCount+1
    FileName := DllCall( "CharUpperA", Str,A_LoopFileName, Str )
    Gui, ListView, LVR
    LV_ADD( "", FileName, IGCount, IconGroups )
    SB_SetText( "`t" FileCount, 1 )
  }
  SB_SetText( "`t" FileCount, 1 ), SB_SetText( "  Done!" , 2 )
  GuiControl, Focus, LVR
  RowNo := 1
  GoSub, LVRSUB
  Gui, ListView, LVI
  LV_Modify( 1, "Select" )
  Gui, ListView, LVR
  GuiControl, Focus, LVR
  LV_Modify( 1, "Select" )
  GuiControl, Focus, tFolder
Return

LVR:
  If ( A_GuiEvent="k" and ( A_EventInfo=40 or A_EventInfo=38 ) ) {
       RowNo := LV_GetNext( 0, "Focused" )
       GoTo, LVRSUB
       Return
  }
 
  If ( A_GuiEvent="k" and A_EventInfo=SaveButton ) {
       RowNo := LV_GetNext( 0, "Focused" )
       IfNotEqual,RowNo,0, GoSub, ExtractIconRes
       Return
  }
  IfNotEqual, A_GuiEvent,Normal, Return
  RowNo := A_EventInfo
LVRSUB: 
  Gui, ListView, LVR
  LV_GetText( File, RowNo,1 ), LV_GetText( IGC, RowNo,2 ), LV_GetText( IG, RowNo,3 )
  SB_SetText( "Press <" KeyName "> to save all icons in " File , 2 ) 
  Gui, ListView, LVI
  LV_Delete()
  ImageListID ? IL_Destroy( ImageListID ) :
  ImageListID := IL_Create( 10,10,1 ), LV_SetImageList(ImageListID)
  Loop, %IGC%
        IL_Add(ImageListID, tFolder "\" File, A_Index )
  Loop, Parse, IG, |
       {
          Gui, ListView, LVI
          LV_Add("Icon" . A_Index, A_LoopField )
       }     
  RowNo := 1
  GoSub, LVISUB
  Gui, ListView, LVR
Return

LVI:
  Gui, ListView, LVI
  If ( A_GuiEvent="k" and ( A_EventInfo>=37 and A_EventInfo<=40 ) ) {
       RowNo := LV_GetNext( 0, "Focused" )
       LV_GetText( IconGroup, RowNo,1 ) 
       SB_SetText( "Press <" KeyName "> to save the Icon Group " IconGroup, 2 )
       GoTo, LVISUB
       Return
  }
  If ( A_GuiEvent="k" and A_EventInfo=SaveButton ) {
       RowNo := LV_GetNext( 0, "Focused" )
       IfNotEqual,RowNo,0,GoSub, ExtractIcon
       Return
  }

  If ( A_GuiEvent="k" and A_EventInfo=0x79 ) {
       GoSub, ApplyIconToFolder
       Return
  }

  IfNotEqual, A_GuiEvent,Normal, Return
  RowNo := A_EventInfo
  LV_GetText( IconGroup, RowNo,1 ) 
  SB_SetText( "Press <" KeyName "> to save the Icon Group " IconGroup, 2 )
LVISUB:
  Gui, ListView, LVI
  LV_GetText( IconGroup, RowNo,1 )
  hMod := DllCall( "LoadLibraryEx", Str,tFolder "\" File, UInt,0, UInt,0x2 )
  Buff := GetResource( hMod, IconGroup, (RT_GROUP_ICON:=14), nSize, hResData )
  Icos := NumGet( Buff+4, 0, "UShort" ), Buff:=Buff+6
  SB_SetText( "`t" Icos " Icons in < Group " IconGroup " >", 3 )
  Loop, %Icos% {
      W   := NumGet( Buff+0,0,"UChar" ),   H   := NumGet( Buff+0,1,"UChar" )
      BPP := NumGet( Buff+0,6,"UShort"),   nID := NumGet( Buff+0,12,"UShort")
      If ( W+H = 0 ) {
        SendMessage, ( STM_SETIMAGE:=0x172 ), 0x1, 0,, % "ahk_id " Icon%A_Index%       
        DllCall( "FreeResource", UInt,hResData )
        GuiControl,,IconT%A_Index%, - 
        Continue
      }
      Buff+=14
      IconD  := GetResource( hMod, nID, (RT_ICON:=3), nSize, hResData )
      Wi := ( W > 64 ) ? 64 : W , Hi := ( H > 64 ) ? 64 : H
      hIcon  := DllCall( "CreateIconFromResourceEx", UInt,IconD, UInt,BPP, Int,1
                        , UInt, 0x00030000, Int,Wi, Int,Hi, UInt,(LR_SHARED := 0x8000) )
      SendMessage, ( STM_SETIMAGE:=0x172 ), 0x1, 0,, % "ahk_id " Icon%A_Index%
      SendMessage, ( STM_SETIMAGE:=0x172 ), 0x1, hIcon,, % "ahk_id " Icon%A_Index%
      DllCall( "FreeResource", UInt,hResData )
      GuiControl,,IconT%A_Index%, % W "x" H "-" BPP "b" 
  }
  Loop % 16-Icos {
      Ix := Icos+A_Index
      GuiControl,,IconT%Ix%, -     
      SendMessage, ( STM_SETIMAGE:=0x172 ), 0x1, 0,, % "ahk_id " Icon%Ix%
  }
  DllCall( "FreeResource", UInt,hResData ), DllCall( "FreeLibrary", UInt,hModule )
Return

GetResource( hModule, rName, rType, ByRef nSize, ByRef hResData ) {
  hResource := DllCall( "FindResource", UInt,hModule, UInt,rName, UInt,rType )
  nSize     := DllCall( "SizeofResource", UInt,hModule, UInt,hResource )
  hResData  := DllCall( "LoadResource", UInt,hModule, UInt,hResource )
Return DllCall( "LockResource", UInt, hResData )
}

ExtractIconRes:
  FileSelectFolder, TargetFolder, *%DEFF%, 3, Extract Icons! Where to?
  IfEqual,TargetFolder,, Return
  GoSub, SetFolder
  hModule := DllCall( "LoadLibraryEx", Str,tFolder "\" File, UInt,0, UInt,0x2 )
  Loop, Parse, IG, |
    {
      FileN := SubStr( "000" A_Index, -3 ) "-" SubStr( "00000" A_LoopField, -4 ) ".ico"
      SB_SetText( (FileN := TargetFolder "\" FileN), 2 ), IconGroup := A_LoopField
      GoSub, WriteIcon
    }
  DllCall( "FreeLibrary", UInt,hModule ), SB_SetText( IGC " Icons extracted!", 2 )
  DllCall( "Sleep", UInt,1000 ), SB_SetText( TargetFolder, 2 )
Return

ExtractIcon:
  LV_GetText( IconGroup, RowNo,1 )
  FileN := SaveIcon( DEFF "\" File "-IG" SubStr( "-00000" IconGroup, -4 ) ".ico" )
  IfEqual,FileN,,Return   
  hModule := DllCall( "LoadLibraryEx", Str,tFolder "\" File, UInt,0, UInt,0x2 )
  GoSub, WriteIcon
  DllCall( "FreeLibrary", UInt,hModule ), SB_SetText( FileN, 2 )
Return

WriteIcon:
 hFile := DllCall( "_lcreat", Str,FileN, UInt,0 )
 sBuff := GetResource( hModule, IconGroup, (RT_GROUP_ICON:=14), nSize, hResData )
 Icons := NumGet( sBuff+0, 4, "UShort" )
 tSize := nSize+( Icons*2 ), VarSetCapacity( tmpBuff,tSize, 0 ), tBuff := &tmpBuff
 CopyData( sBuff, tBuff, 6  ),   sBuff:=sBuff+06,  tBuff:=tBuff+06
 Loop %Icons%
      CopyData( sBuff, tBuff, 14  ),  sBuff:=sBuff+14,  tBuff:=tBuff+16
 DllCall( "FreeResource", UInt,hResData )
 DllCall( "_lwrite", UInt,hFile, Str,tmpBuff, UInt,tSize )
 EOF := DllCall( "_llseek", UInt,hFile, UInt,-0, UInt,2 )
 VarSetCapacity( tmpBuff, 0 )
 DataOffset := DllCall( "_llseek", UInt,hFile, UInt,18, UInt,0 )

 Loop %Icons% {
      VarSetCapacity( Data,4,0 )
      DllCall( "_lread", UInt,hFile, Str,Data, UInt,2 ),
      nID := NumGet( Data, 0, "UShort" )
      DllCall( "_llseek", UInt,hFile, UInt,-2, UInt,1 )
      NumPut( EOF, Data ),  DllCall( "_lwrite", UInt,hFile, Str,Data, UInt,4 )
      DataOffset := DllCall( "_llseek", UInt,hFile, UInt,0, UInt,1 )
      sBuff := GetResource( hModule, nID, (RT_ICON:=3), nSize, hResData )   
      DllCall( "_llseek", UInt,hFile, UInt,0, UInt,2 )         
      DllCall( "_lwrite", UInt,hFile, UInt,sBuff, UInt,nSize )
      DllCall( "FreeResource", UInt,hResData )
      EOF := DllCall( "_llseek", UInt,hFile, UInt,-0, UInt,2 )
      DataOffset := DllCall( "_llseek", UInt,hFile, UInt,DataOffset+12, UInt,0 )
 } 
 DllCall( "_lclose", UInt,hFile )
Return

SelectSimpleIcon:
  StringTrimLeft,FNo,A_GuiControl,1
  GuiControlGet, IconT%fNo%
  If ( (IconT := IconT%fNo%) = "-" )
       Return
  SB_SetText("Press <" KeyName "> to save Icon " IconT  " from Icon Group " IconGroup ,2)
  GuiControl, Enable, Hotkey
  GuiControl, Focus,  Hotkey
  GuiControl,,Hotkey
  SetTimer, DisableHotkey, -5000
Return

DisableHotkey:
  GuiControlGet, Hotkey, Enabled
  If ( Hotkey ) {
  GuiControl,,Hotkey
  GuiControl, Disable, Hotkey
  GuiControl, Focus, LVI
  StatusBarGetText, SbTxt, 2, IconEx
  InStr( SbTxt, "to save Icon") ? SB_SetText( "", 2 ) :
  }   
Return 

CreateSimpleIcon:
  SB_SetText( "", 2 )
  GuiControlGet, Hotkey
  GuiControl, Disable, Hotkey
  IfNotEqual, Hotkey, %KeyName%, Return

  FileN := SaveIcon( Deff "\" File " [" SubStr("0000" IconGroup, -4 ) "-"
                    . SubStr( "0" FNo,-1) "][ " IconT "].ico" )           
  IfEqual,FileN,, Return     
  hModule := DllCall( "LoadLibraryEx", Str,tFolder "\" File, UInt,0, UInt,0x2 )
  Buffer := GetResource( hModule, IconGroup, (RT_GROUP_ICON:=14), nSize, hResData )
  tBuff := Buffer+6+((Fno-1)*14), nID := Numget( tBuff+0, 12, "Ushort" )
  VarSetCapacity(Z,10,0), NumPut(1,Z,2,"UChar"), NumPut(1,Z,4,"UChar" ),NumPut(22,Z,6)
  SBuff := GetResource( hModule, nID, (RT_ICON:=3), nSize, hResData )
  hFile := DllCall( "_lcreat", Str,FileN, UInt,0 )
  DllCall( "_lwrite", UInt,hFile, Str,Z, UInt,6 )
  DllCall( "_lwrite", UInt,hFile, UInt,tbuff, UInt,12 )
  DllCall( "_lwrite", UInt,hFile, UInt,&Z+6, UInt,4 )
  DllCall( "FreeResource", UInt,hResData )
  Buff := GetResource( hModule, nID, (RT_ICON:=3), nSize, hResData )
  DllCall( "_lwrite", UInt,hFile, UInt,Buff, UInt,nSize )
  DllCall( "_lclose", UInt,hFile )
  DllCall( "FreeResource", UInt,hResData ),  DllCall( "FreeLibrary", UInt,hModule )
  SB_SetText( FileN, 2 )
Return

FindTarget:
  StatusBarGetText, SB, 2, A
  IfExist, %SB%, Run, %COMSPEC% /c "Explorer /select`, %SB%",,Hide
Return

SetFolder:
  ControlGetText,tFolder,, ahk_id %hSHAC%
  If ! InStr( FileExist( tFolder ), "D" ) {
    SplitPath, tFolder,, tFolder
    ControlSetText,,% (tFolder:=DllCall("CharUpperA",Str,tFolder,Str )), ahk_id %hSHAC%
 }     
Return

SelectFolder:
  GoSub, SetFolder
  FileSelectFolder, nFolder, *%tFolder%, , Select a Resource Folder
  IfEqual,nFolder,,Return
  ControlSetText,,%nFolder%, ahk_id %hSHAC%
  GoSub, SetFolder
  GoSub, UpdateResourceList
Return

CopyData( SPtr, TPtr, nSize ) {
  Return DllCall( "RtlMoveMemory", UInt,TPtr, UInt,SPtr, UInt,nSize )
}

SaveIcon( Filename, Prompt="Save Icon As"  ) {
  FileSelectFile, File, 16, %Filename%, %Prompt%, Icon (*.ico)
Return ( File <> "" and SubStr( File, -3 ) <> ".ico" ) ? File ".ico" : File
}

Accelerator:
 IfEqual,A_GuiControl,&File, GuiControl,Focus,LVR
 IfEqual,A_GuiControl,&Icon, GuiControl,Focus,LVI
 IfEqual,A_GuiControl,A&ddress Bar, GuiControl,Focus,tFolder
 IfEqual,A_GuiControl,&Reload,IfExist,%tFolder%\%File%
    {
      FileAppend,%tFolder%\%File%,%A_Temp%\IconEx.tmp
      Reload     
    }
 
Return
 
GuiContextMenu:
  StatusBarGetText, SbTxt, 2, IconEx
  StringTrimLeft, SbTxt,SbTxt, 14
  If ( SubStr( SbTxt, 1,4) = "save" )
     SendInput {%KeyName%}
Return   

GuiClose:
  ExitApp
 
ApplyIconToFolder:
 FileSelectFolder, applyFolder,::{20d04fe0-3aea-1069-a2d8-08002b30309d},0, Apply Folder Icon
 If ( applyFolder="" OR ErrorLevel )
    Return
 dini := applyFolder "\Desktop.ini"
 IniRead, iconFile, %dini%, .ShellClassInfo, IconFile, %A_Space%
 If ( SubStr(iconFile,1,7 ) == "IconEx_" )
    FileDelete,%applyFolder%\%iconFile%
 iconFile := ( "IconEx_" HashStr( A_Now ) ".ico" ), FileN := applyFolder "\" iconFile
 hModule := DllCall( "LoadLibraryEx", Str,tFolder "\" File, UInt,0, UInt,0x2 )
 LV_GetText( IconGroup, RowNo,1 )
 GoSub, WriteIcon
 DllCall( "FreeLibrary", UInt,hModule ), SB_SetText( FileN, 2 )
 IniWrite, %IconFile%, %dini%, .ShellClassInfo, IconFile
 IniWrite, 0         , %dini%, .ShellClassInfo, IconIndex
 FileSetAttrib, +S, %applyFolder%
 FileSetAttrib, +SH, %dini%
 FileSetAttrib, +SH, %FileN%
 ; SHCNE_ASSOCCHANGED := 0x8000000
 DllCall( "Shell32\SHChangeNotify", UInt,0x8000000, UInt,0x0, UInt,0, UInt,0 )
 Run Properties "%applyFolder%"
Return

HashStr( sStr="" ) {
 Static hHash=12345678
 DllCall( "shlwapi\UrlHashA",  Str,sStr, UIntP,dHash, UInt,4 )
 DllCall( "msvcrt.dll\sprintf", Str,hHash, Str,"%08X", UInt,dHash )
 Return ( sStr<>"" ) ? hHash :
}


This works in XP SP2, but in Vista, to apply changes - either we have to Restart windows or Explorer.exe :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2008, 12:06 pm 
Offline

Joined: December 29th, 2008, 9:49 am
Posts: 29
Location: Malaysia
cool utility, im gonna try it out.
i once tried to make one myself but it failed horribly.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 3:16 am 
Offline

Joined: February 17th, 2008, 3:27 am
Posts: 24
Location: CHINA
Image

as picture above :
IconEX v1. 0 didn't list all of the ICONS in the CCleaner. exe

_________________
喜欢看中文的可以来 AutoHotkey 爱好者论坛 : forum.ahkbbs.cn | ahk.5d6d.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 3:37 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
The third icon (only), uses compression which my script ( or ResHacker ) cannot handle - but problem is my scripts skips also the rest of them.
I need sometime to research and add an exception to avoid compressed frames.

Thanks for reporting this. :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 5:06 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
SKAN wrote:
@vixay

Select an Icon in IconView and press <F10>

IconEx v1.2b by SKAN ( arian.suresh@gmail.com ) || CD: 13-May-2008 | LM: 27-Dec-2008

This works in XP SP2, but in Vista, to apply changes - either we have to Restart windows or Explorer.exe :(


Hey, Cool, this works (XP SP3)!! Thanks a ton! :) This is brilliant!

You can add
Code:
InfoTip=Icon changed by IconEx

to the desktop.ini to create awareness or any other funky thing i suppose :)


I see that you are extracting the icon to the folder and creating the desktop.ini and the properties dialog pops up.
Is it necessary to extract the icon to that folder, for this to work? I'm guessing not, but it's a good sensible default.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 5:47 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
vixay wrote:
Is it necessary to extract the icon to that folder, for this to work? I'm guessing not, but it's a good sensible default.


1) IconEx has the power to extract, so I want to excercise it.
2) Icon gets copied and works when I backup the folder to Optical Disk / USB

I will try hard to make this stuff work in Vista.. If succesful, I will update the title post with the newer version.

Thanks.

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2009, 12:05 pm 
This script is a gem!

Thanks a lot!!!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 30th, 2009, 3:09 pm 
Offline

Joined: November 20th, 2008, 6:00 pm
Posts: 72
Location: Thionville, France
Cool script!

Icon groups which have a name with letters instead of numbers won't be extracted correctly, as in Skype.exe:
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 30th, 2010, 4:18 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776


Yook wrote:
Icon groups which have a name with letters instead of numbers won't be extracted correctly, as in Skype.exe


Fixed! Sorry for the delay. I did not know how to test if an integer was actually a memory pointer, until today!

Code:
EnumResNameProc( hModule, lpszType, lpszName, lParam ) {
 Global IconGroups, IGCount
 If DllCall( "msvcrt\_msize", UInt,lpszName ) ; if lpszName is memory pointer
    lpszName := DllCall( "MulDiv", Int,lpszName, Int,1, Int,1, Str ) ; Extract and use the String instead

 IconGroups .= ( ( IconGroups!="" ) ? "|" : "" ) . lpszName , IGCount:=IGCount+1
 Return True
}


GetResource() has been altered to handle the above change:

Code:
GetResource( hModule, rName, rType, ByRef nSize, ByRef hResData ) {
   Arg := ( rName+0 = "" ) ? "Str" : "UInt"
   hResource := DllCall( "FindResource", UInt,hModule, Arg,rName, UInt,rType )
   nSize := DllCall( "SizeofResource", UInt,hModule, UInt,hResource )
   hResData  := DllCall( "LoadResource", UInt,hModule, UInt,hResource )
   Return DllCall( "LockResource", UInt, hResData )
}


    Image
    Note: The Fifth frame of MAINICON is 256x256 PNG, so it is not displayed. But if MAINICON is extracted, it will contain the PNG frame.
    The single PNG frame alone cannot be extracted with current version.

ttzm wrote:
IconEX v1. 0 didn't list all of the ICONS in the CCleaner. exe


Now Fixed! The third Item is a 256x256 PNG, so it was being skipped.. but the rest of the frames will be displayed properly with the fixed version.
    Image


Code:
LVISUB:
  Gui, ListView, LVI
  LV_GetText( IconGroup, RowNo,1 )
  hMod := DllCall( "LoadLibraryEx", Str,tFolder "" File, UInt,0, UInt,0x2 )
  Buff := GetResource( hMod, IconGroup, (RT_GROUP_ICON:=14), nSize, hResData )
  Icos := NumGet( Buff+4, 0, "UShort" ), Buff:=Buff+6
  SB_SetText( "`t" Icos " Icons in < Group " IconGroup " >", 3 )
  Loop, %Icos% {
      W   := NumGet( Buff+0,0,"UChar" ),   H   := NumGet( Buff+0,1,"UChar" )
      BPP := NumGet( Buff+0,6,"UShort"),   nID := NumGet( Buff+0,12,"UShort")
      Buff += 14 ; Now Corrected
      If ( W+H = 0 ) {
        SendMessage, ( STM_SETIMAGE:=0x172 ), 0x1, 0,, % "ahk_id " Icon%A_Index%       
        DllCall( "FreeResource", UInt,hResData )
        GuiControl,,IconT%A_Index%, - 
        Continue
      }
 ;    Buff += 14 ; Incorrect


It is possible to extract and save 256x256 PNG Icon as either ICON or PNG. But to display it in the GUI we need to call GDI+.

Thanks to Obi-Wahn for reminding me to update. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 30th, 2010, 10:11 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Okay!. PNG Icon frame ( though un-viewable), can now be extracted like other single frames.



Note: You may chop-off the first 22 bytes in a PNG single frame icon to make it a proper PNG image.

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2010, 7:00 pm 
Offline

Joined: February 27th, 2009, 9:11 am
Posts: 693
Location: Burbank, California
Another jewel... Thank you SKAN!

_________________
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom" but let's start to get the data...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2010, 10:21 pm 
Offline

Joined: April 20th, 2006, 5:11 pm
Posts: 75
Location: Vienna
Thanks again for your help SKAN.

I'm working now on a new Script, and finally it should extract the biggest icon as a .png-File.
So I thought, It'd be a good idea to start with counting and querying the icongroup-names.

It helped that you updated your IconEx script, but as far as I'm concerned, it doesn't work properly when I select Skype.exe (you know, the issue with the non-numeric iconname)

Sometimes it works, and sometimes it doesn't, in this case it displays random(?) digits which the script can't find and so it doesn't display the other icons.

Again, I extracted a few lines, which I'd like to use in my script...

Code:
File := A_Programfiles "\Skype\Phone\Skype.exe"

Msgbox, % $COUNT_ICONGROUPS( File ) "`n`n" IconGroups
ExitApp

$COUNT_ICONGROUPS( $FILE ) {
   global IconGroups, IGCount
   If !FileExist( $FILE )
      Return, false
   hModule := DllCall("LoadLibraryEx", Str, $FILE, UInt, 0, UInt, 0x2)
   IGCount := 0, IconGroups := ""
   DllCall("EnumResourceNamesA", UInt, hModule, UInt, (RT_GROUP_ICON := 14), UInt, RegisterCallback("EnumResNameProc"), UInt, 0)
   DllCall("FreeLibrary", UInt, hModule)
   Return, IGCount
}

EnumResNameProc( hModule, lpszType, lpszName, lParam ) {
   Global IconGroups, IGCount
   If DllCall( "msvcrt\_msize", UInt, lpszName ) ; if lpszName is memory pointer
      lpszName := DllCall( "MulDiv", Int, lpszName, Int, 1, Int, 1, Str ) ; Extract and use the String instead
   IconGroups .= ( IconGroups ? "|" : "" ) lpszName , IGCount++
   Return, True
}


Maybe it depends on the OS. I'm using Win 7 Pro 64 right now...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: DataLife and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group