Marshin Posted May 8, 2008 Share Posted May 8, 2008 not sure this is the right forum. but is it possible to get the image/icon from a saved file (*.dwg,*.pdf ...) , I have looked through the forum and couldn't find anything. At last, after two thousand years of research, the illudium Q-36 explosive space modulator.Well, back to the old drawing board. Link to comment Share on other sites More sharing options...
nobbe Posted May 8, 2008 Share Posted May 8, 2008 try to search for enumicons_v2.au3 Link to comment Share on other sites More sharing options...
danielkza Posted May 8, 2008 Share Posted May 8, 2008 MSDN Reference:SHGetFileInfoGlobal Const $tagSHFILEINFO = "hwnd hIcon;int iIcon;dword Attr;wchar DisplayName[260];char TypeName[80]" Global Const $SHGFI_ICON = 256 Global Const $SHGFI_DISPLAYNAME = 512 Global Const $SHGFI_TYPENAME = 1024 Global Const $SHGFI_ATTRIBUTES = 2048 Global Const $SHGFI_ICONLOCATION = 4096 Global Const $SHGFI_EXETYPE = 8192 Global Const $SHGFI_SYSICONINDEX = 16384 Global Const $SHGFI_LINKOVERLAY = 32768 Global Const $SHGFI_SELECTED = 65536 Global Const $SHGFI_ATTR_SPECIFIED = 131072 Global Const $SHGFI_LARGEICON = 0 Global Const $SHGFI_SMALLICON = 1 Global Const $SHGFI_OPENICON = 2 Global Const $SHGFI_SHELLICONSIZE = 4 Global Const $SHGFI_PIDL = 8 Global Const $SHGFI_USEFILEATTRIBUTES = 16 Func _SHGetFileInfo(ByRef $tFileInfo,Const $File,Const $dwAttr = 0,Const $Flags = 0) If NOT $tFileInfo Then $tFileInfo = DllStructCreate($tagSHFILEINFO) EndIF If @error Then Return SetError(1,0,$tFileInfo) Local $Ret = DllCall("shell32.dll","int","SHGetFileInfo","str",$File,"dword",$dwAttr, _ "ptr",DllStructGetPtr($tFileInfo),"uint",DllStructGetSize($tFileInfo),"uint",$Flags) If $Ret[0] = 0 Then Return SetError(2,0,False) Return SetError(0,$Ret[0],$tFileInfo) EndFunc Link to comment Share on other sites More sharing options...
Marshin Posted May 9, 2008 Author Share Posted May 9, 2008 nobbe thank you, but enumicons_v2.au3 only shows the icons for dll's and exe's. danielkza thank you for the code, it looks like it will do what I need to do but I am not completely sure how to make it work. At last, after two thousand years of research, the illudium Q-36 explosive space modulator.Well, back to the old drawing board. Link to comment Share on other sites More sharing options...
danielkza Posted May 9, 2008 Share Posted May 9, 2008 nobbe thank you, but enumicons_v2.au3 only shows the icons for dll's and exe's. danielkza thank you for the code, it looks like it will do what I need to do but I am not completely sure how to make it work. Func _ShellGetAssocIcon(Const $szFile,Const $IconFlags = 0) Local $tFileInfo = DllStructCreate($tagSHFILEINFO) If @error Then Return SetError(1,@extended,0) EndIf Local $Ret = DllCall("shell32.dll","int","SHGetFileInfo","str",$szFile,"dword",0, _ "ptr",DllStructGetPtr($tFileInfo),"uint",DllStructGetSize($tFileInfo),"uint",BitOr($SHGFI_ICON,$IconFlags)) MsgBox(0,0,@error) Return DllStructGetData($tFileInfo,"hIcon") EndFunc Don't forget to call _WinAPI_DestroyIcon after you're done with the icon.Check the extra flags in the MSDN page in the first post. 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