DOdeclare* an instance of gdiplusinit should be created before * and released after using any of gdi+ objectsPRIVATE gdip As gdiplusinit
gdip = NEWOBJECT("gdiplusinit", "gdiplus.prg")LOCAL cSourceFile, hModule, nIconIndex, hIcon, cTargetFile
hModule = GetModuleHandle(0)* use any EXE or DLL file that contains icons*!* cSourceFile = "C:\Program Files\Microsoft Visual Studio " +;*!* ".NET\Common7\IDE\devenv.exe"
cSourceFile = _vfp.ServerName* enumerating icons in the source file from 0 and on
nIconIndex = 0DOWHILE .T.
hIcon = ExtractIcon(hModule, cSourceFile, nIconIndex)IF hIcon <> 0 * PNG, TIF * BMP, JPG, GIF * make sure the target path is valid
cTargetFile = "c:\temp\appicon" +;
STRTRAN(STR(nIconIndex,3)," ","0") + ".png"LOCAL oBitmap As gdibitmap
oBitmap = NEWOBJECT("gdibitmap", "gdiplus.prg")WITH oBitmap
.CreateFromHIcon(m.hIcon)IF .SaveToFile(cTargetFile)? cTargetFile + " saved"ELSE? cTargetFile + " - error"ENDIFENDWITH
oBitmap=NULL
= DestroyIcon(hIcon)
nIconIndex = nIconIndex + 1ELSEEXITENDIFENDDOPROCEDUREdeclareDECLAREINTEGER DestroyIcon IN user32 INTEGER hIcon
DECLAREINTEGER ExtractIcon IN shell32;
INTEGER hInst, STRING lpszExeFileName,;
INTEGER lpiIcon
DECLAREINTEGER GetModuleHandle IN kernel32;
INTEGER lpModuleName
Credits: PHP (4.4.9), an HTML-embedded scripting language,
MySQL (5.1.55-log), the Open Source standard SQL database,
AceHTML Freeware
Version 4, freeware HTML Editor of choice. Hosted by Korax Online Inc.