Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find the icon associated to a certain file type
#7
It worked, following the guidance given above. I attach the routines for any comments.

Function Dialog137c_Write
Code:
Copy      Help
;http://www.quickmacros.com/forum/viewtopic.php?p=31363

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Button 0x54034040 0x4 31 16 15 14 "Button"
;4 Button 0x54034040 0x4 81 17 15 14 "Button"
;5 Button 0x54034040 0x4 131 16 15 14 "Button"
;6 Button 0x54034040 0x4 175 16 15 14 "Button"
;7 Button 0x54034040 0x4 206 16 15 14 "Button"
;8 Button 0x54034040 0x4 31 41 15 14 "Button"
;9 Button 0x54034040 0x4 79 42 15 14 "Button"
;10 Button 0x54034040 0x4 131 42 15 14 "Button"
;11 Button 0x54034040 0x4 174 40 15 14 "Button"
;12 Button 0x54034040 0x4 206 42 15 14 "Button"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam
int handle i
sel message
,case WM_INITDIALOG
;,__ImageList- il=ImageList_Create(16 16 ILC_MASK|ILC_COLOR32 0 8)
,__ImageList-- il.Load("C:\Documents and Settings\S.E.Simopoulos\My QM\imagelists\Tamtiriri.bmp")

,str sico
,int n=ImageList_GetImageCount(il)
,outt F"{n}"
,ImageList_ReplaceIcon(il 2 GetIcon(".eml")) ;; replace existing
,ImageList_ReplaceIcon(il -1 GetIcon(".pdf")) ;; add new
,ImageList_ReplaceIcon(il -1 GetIcon(".jpg"))
,n =ImageList_GetImageCount(il)
,outt F"{n}"
,
,for i 0 n
,,handle=ImageList_GetIcon(il i 0)
,,SendMessage(id(i+3 hDlg) BM_SETIMAGE IMAGE_ICON handle)
;
,__Stream x
;
,str f="C:\tmp\ses_Stream.txt"
,int fl=0x00000002 ;;STGM_READWRITE
,if(!FileExists(f)) fl|0x00001000 ;;STGM_CREATE
,x.CreateOnFile(f fl)

,ImageList_Write(il x)



,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Function Dialog137d_Read
Code:
Copy      Help
;http://www.quickmacros.com/forum/viewtopic.php?p=31363

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Button 0x54034040 0x4 31 16 15 14 "Button"
;4 Button 0x54034040 0x4 81 17 15 14 "Button"
;5 Button 0x54034040 0x4 131 16 15 14 "Button"
;6 Button 0x54034040 0x4 175 16 15 14 "Button"
;7 Button 0x54034040 0x4 206 16 15 14 "Button"
;8 Button 0x54034040 0x4 31 41 15 14 "Button"
;9 Button 0x54034040 0x4 79 42 15 14 "Button"
;10 Button 0x54034040 0x4 131 42 15 14 "Button"
;11 Button 0x54034040 0x4 174 40 15 14 "Button"
;12 Button 0x54034040 0x4 206 42 15 14 "Button"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam
int handle i
sel message
,case WM_INITDIALOG
,__ImageList- il

,__Stream x
;
,str f="C:\tmp\ses_Stream.txt"
,int fl=0x00000002 ;;STGM_READWRITE
,if(!FileExists(f)) fl|0x00001000 ;;STGM_CREATE
,x.CreateOnFile(f fl)
,il=ImageList_Read(x)

,,
,str sico
,int n=ImageList_GetImageCount(il)
,outt F"{n}"
,
,for i 0 n
,,handle=ImageList_GetIcon(il i 0)
,,SendMessage(id(i+3 hDlg) BM_SETIMAGE IMAGE_ICON handle)
;

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)