08-30-2007, 07:18 AM
Function ChooseIconDialog
;/
function# str&path &index [$defaultpath] [defaultindex] [hwndOwner]
;Shows 'Change Icon' dialog.
;Returns 1 on OK, 0 on Cancel.
;path - str variable that receives icon file path.
;index - int variable that receives icon index.
;defaultpath, defaultindex - can be used to initialize the dialog.
;hwndOwner - handle of owner window or 0.
;EXAMPLE
;str s; int i
;if(!ChooseIconDialog(s i)) ret
;out "%s,%i" s i
dll shell32 [62]#PickIconDlg_NT hwnd @*pszIconPath cbIconPath *piIconIndex
dll shell32 [62]#PickIconDlg_9x hwnd $pszIconPath cbIconPath *piIconIndex
str sd.expandpath(defaultpath); if(sd.len>MAX_PATH) sd.all
index=defaultindex
if(_winnt)
,BSTR b.alloc(MAX_PATH); b[0]=0
,if(sd.len) sd.unicode; memcpy b.pstr sd sd.len+2
,
,if(!PickIconDlg_NT(hwndOwner b.pstr MAX_PATH+1 &index)) ret
,path.ansi(b.pstr)
else
,sd.set(0 sd.len MAX_PATH)
,if(!PickIconDlg_9x(hwndOwner sd MAX_PATH+1 &index)) ret
,path=sd.lpstr
path.expandpath
ret 1