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:
01045284
Vues:
36
>Urfan,
>
>This is not a beauty but it will get You running (for mor info see message #656045 where
>I basicly have the code from.
>
>Create a form with a Commandbutton and an imageList Control named ImageList.
>Additionally add a Method DWORD
>
>In the commandbutton put
>
>#define PICTYPE_ICON 3
>#define IID_IDispatch Chr(0x00)+Chr(0x04)+Chr(0x02)+Chr(0x00)+ ;
>		Replicate(Chr(0x00), 4)+Chr(0xC0)+Replicate(Chr(0x00), 6)+Chr(0x46)
>
>* Large icons
>Declare long ExtractIconEx in shell32 String @ File, long iconIndex, ;
>	long @ iconLarge, long iconSmall, long nIcons
>* Small icons
>*Declare long ExtractIconEx in shell32 String @ File, long iconIndex, ;
>*	long iconLarge, long @ iconSmall, long nIcons
>
>Declare Long OleCreatePictureIndirect In oleaut32 ;
>	String @ PicDesc, String @ RefIID, Long fPictureOwnsHandle, Object @ IPic
>
>*IconFile = "D:\Program Files\Microsoft Visual Studio\VFP98\VFP6.exe"
>iconFile = GetFile("EXE")
>IconIndex = 6
>hIcon = 0
>
>* Large icon
>ExtractIconEx(@IconFile, IconIndex, @hIcon, 0, 1)
>* SmallIcon
>*ExtractIconEx(@IconFile, IconIndex, 0, @hIcon, 1)
>
>* Create Picture object according to PICTDESC structure
>PictDesc = Thisform.DWord(16) ;				&& Size of PICTDESC structure
>		 + Thisform.DWord(PICTYPE_ICON) ;	&& Type of picture
>		 + Thisform.DWord(hIcon) ;		&& HICON
>		 + Thisform.DWord(0)			&& HPALETTE
>IPic = 0
>iid = IID_IDispatch
>OleCreatePictureIndirect(@PictDesc, @iid, 1, @IPic)
>
>Thisform.ImageList.ListImages.ADD(,"SomePict",IPic)
>
>
>and in the DWORD-Method
>
>	*PROCEDURE LongToStr
>	* This function converts a long to a string
>		PARAMETERS nLongVal
>		LOCAL nLoopVar, strReturn
>
>		strReturn 	= ""
>		FOR nLoopVar = 24 TO 0 STEP -8		&& Long ist vier bytes lang
>			strReturn = CHR(INT(nLongVal/(2^nLoopVar))) + strReturn
>			nLongVal 	= MOD(nLongVal, (2^nLoopVar))
>		NEXT
>	RETURN strReturn
>
>
>Save and run the form. Click on the button and select EXCEL.EXE for excample.
>
>
>? m.MyForm.imageList.listImages.count
>
>
>should now return 1.
>
>There are several messages about ExtractAssociatedIcon etc. (Also have a look
>at the WinAPI-Section). These all get You a handle to an Icon. For me the hardest
>thing was to actually get this into a "PICTURE" that can pe put in an ImageList
>witch this does. From here it should be quite simple to get the associated file
>for a given extension etc.
>
>Let me know if I can be of any more help

Frank,

Once you have this picture, how can you display it in a grid? E.g. I've implemented the ListView interface using your IconBuddy and MS ListView samples, but I don't like the look. My manager also wants it grid based (perhaps he doesn't care about the icons at all, but I'd like to have them). Any idea of using your class with grids rather than with ListView?

Thanks a lot in advance.
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