Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File association icons
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00728027
Message ID:
01045837
Vues:
38
Frank,

May be SavePicture is not sophisticated enough. I guess there is API analogue, that could be better. Here is my current code, the ico files it produces don't look like icons:
*---------------------- Location Section ------------------------
*   Library: 	Iconbuddy.vcx
*   Class: 		Iconbuddy
*   Method: 	Createtmpiconfile()
*----------------------- Usage Section --------------------------
*)  Description:
*)

*   Scope:      Public
*   Parameters: tcFile
*$  Usage:
*$
*   Returns:
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	08/30/2005 - NN (Frank Dietrich)
*		MODIFIED
*----------------------------------------------------------------
lparameters tcFile as string, tcFileType as string

local lcExtension, loItem, lcIconFile, lcOutFile, ;
	lcOutStem, loIconLarge, loIconSmall, lnIconsFound, lcTempPath
*-- Get the extension of the given file
lcExtension = lower(justext(tcFile))

*-- and see if we already have an icon for it
lcIconFile = this.GetIconFile(lcExtension)

if empty(lcIconFile)
*-- Not in the collection yet

	loItem = createobject("EMPTY")
	addproperty(loItem, "cIconLarge", "")
	addproperty(loItem, "cIconSmall", "")
	addproperty(loItem, "cFileType", "")

*-- now extract the icons for the filetype
	loIconLarge  = .null.
	loIconSmall  = .null.
	lnIconsFound = this.GetAssocIconPairObjects(tcFile, @loIconLarge, @loIconSmall)
	lcTempPath = addbs(Fn2Lfn(sys(2023)))

	if lnIconsFound = 2
*-- Save the IconObject to disk
		lcOutStem = "ICN"+ sys(2015)
		lcOutFile = lcTempPath + lcOutStem + "_L.ICO"
** we don't have Save2File method implemented
*	this.Save2File( loIconLarge, lcOutFile )
		= savepicture(loIconLarge, lcOutFile)

*-- and keep for further reference
		loItem.cIconLarge = lcOutFile

*-- and do the same with the small icon
		lcOutFile = lcTempPath + lcOutStem + "_S.ICO"
*		this.Save2File( loIconSmall, lcOutFile )
		= savepicture(loIconSmall, lcOutFile)
*-- and keep for further reference
		loItem.cIconSmall = lcOutFile
		loItem.cFileType = this.cFileType
	endif

*-- ... and add the Item to the Collection
	this.oIcons.add( loItem, lcExtension )

endif

return
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform