吹版的武功当真深不可测!
不是我擦鞋——实在是一对靴子油光锃亮,端的煞是好看!
啧啧。
以下是引用吹水佬在2022-10-14 00:00:52的发言:
搜了一下 system32 的文件
cDefPath = ADDBS(JUSTPATH(SYS(16)))
SET DEFAULT TO (cDefPath)
DECLARE long ExtractIcon IN shell32 as apiExtractIcon long,string,long
DECLARE long DestroyIcon IN user32 as apiDestroyIcon long
DECLARE long GetWindowsDirectory IN kernel32 as apiGetWindowsDirectory string@,long
DECLARE long GdiplusStartup IN gdiplus as apiGdiplusStartup long@,string@,long
DECLARE long GdiplusShutdown IN gdiplus as apiGdiplusShutdown long
DECLARE long GdipCreateBitmapFromHICON IN gdiplus as apiGdipCreateBitmapFromHICON long,long@
DECLARE long GdipDisposeImage IN gdiplus as apiGdipDisposeImage long
DECLARE long GdipSaveImageToFile IN gdiplus as apiGdipSaveImageToFile long,string,string,long
#define MAX_PATH 260
#define GWL_HINSTANCE -6
#define CLSID_PNG 0h06F47C55041AD3119A730000F81EF32E
CREATE CURSOR sysTable (sysfile v(254), icoCount I, sysPath v(254))
CREATE CURSOR icoTable (img v(1), icoFile v(254), sysfile v(254), icoPath v(254))
stGSI = 0h01000000000000000000000000000000
pGDI = 0
apiGdiplusStartup(@pGDI, @stGSI, 0)
cMsg = "获取数据,请稍候......"
WAIT cMsg NOWAIT NOCLEAR WINDOW AT WLROW()+WROWS()/2, WLCOL()+(WCOLS()-LEN(cMsg))/2
winPath = SPACE(MAX_PATH)
len = apiGetWindowsDirectory(@winPath, MAX_PATH)
winPath = LEFT(winPath,len)+ "\system32\"
FOR i=1 TO ADIR(aFile, winPath+"*.*", "AHS")
fn = winPath + aFile[i,1]
IF !FILE(fn)
LOOP
ENDIF
nCnt = apiExtractIcon(0, fn, -1)
IF nCnt == 0
LOOP
ENDIF
INSERT INTO sysTable VALUES (aFile[i,1], nCnt, winPath)
ENDFOR
num = 1
SELECT sysTable
SCAN
fn = winPath + sysTable.sysFile
FOR icoIndex=0 TO icoCount-1
hIcon = apiExtractIcon(0, fn, icoIndex)
hBitmap = 0
apiGdipCreateBitmapFromHICON(hIcon, @hBitmap)
outFile = "icon"+PADL(num,4,"0")+".png"
num = num + 1
apiGdipSaveImageToFile(hBitmap, STRCONV(cDefPath+outFile+0h00,5), CLSID_PNG, 0)
apiGdipDisposeImage(hBitmap)
apiDestroyIcon(hIcon)
INSERT INTO icoTable VALUES ("", outFile, sysTable.sysFile, cDefPath)
ENDFOR
ENDSCAN
GO TOP IN "sysTable"
GO TOP IN "icoTable"
WAIT CLEAR
of = CREATEOBJECT("icoForm")
of.show(1)
CLEAR RESOURCES
SELECT icoTable
SCAN
DELETE FILE (icoFile)
ENDSCAN
apiGdiplusShutdown(pGDI)
RETURN
DEFINE CLASS icoForm as Form
width = 800
height = 500
ADD OBJECT icoGrid as icoGrid
ADD OBJECT sysGrid as grid WITH left=301,width=500,height=500,RecordSource="sysTable"
PROCEDURE init
this.icoGrid.AutoFit()
this.sysGrid.AutoFit()
ENDPROC
ENDDEFINE
DEFINE CLASS icoGrid as Grid
width = 300
height = 500
RecordSource = "icoTable"
PROCEDURE init
this.RowHeight = 32
this.Column1.width = 32
this.Column1.RemoveObject("text1")
this.Column1.AddObject("img","icoImage")
this.Column1.Sparse = .F.
ENDPROC
ENDDEFINE
DEFINE CLASS icoImage as Image
Stretch = 1
PROCEDURE BackStyle_ACCESS
this.picture = icoTable.icoFile
RETURN this.BackStyle
ENDPROC
ENDDEFINE