Home > database >  Consult to sleep on the night of city teacher: save icon file
Consult to sleep on the night of city teacher: save icon file

Time:10-01

M.c Enc_ico=0 h00f47c55041ad3119a730000f81ef32e
M.i I=88

M.h Bmp=0
If 0==GdipCreateBitmapFromHICON (m.o on Iml. ListImages (m.i I) ExtractIcon (). The Handle, @ m.h Bmp)
M.c File=Textmerge (SYS (5) + CURDIR () + "ico \ Folder_open. Ico") & amp; & C: \ extract ICONS & lt; The ico ')
If 0==GdipSaveImageToFile (m.h Bmp, Strconv (m.c File + CRH (0), 5), m.c Enc_ico, 0)
* MESSAGEBOX (Textmerge (' saved icon & lt; To & lt; '))
The Else
* MESSAGEBOX (Textmerge ('!!!!!! The save icon & lt; Failure, '))
Endif
GdipDisposeImage m.h (Bmp)
The Else
*? '--!!!!!! Failed to create a bitmap object. '
Endif
GdiplusShutdown m.h (Tk)

* - * to this step can extract a fake ICO file, then use your switch statement, but is not successful, consult the reason

CTempFileName=m.c File

* in front with a constant definition:
* * * * * * LoadImage defines
# define IMAGE_BMP 0
# define IMAGE_ICON 1
# define LR_LOADFROMFILE 0 x0010

* and then find and modify:

MESSAGEBOX (cTempFileName)
M.h Image=WinAPI_LoadImage (0, cTempFileName, iif (the lower (justext (cTempFileName))=='ico', IMAGE_ICON, IMAGE_BMP), 0, 0, LR_LOADFROMFILE) & amp; & Don 't load from the resource file

Declare long GdiplusStartup in gdiplus long @, string, long @
Declare long GdiplusShutdown gdiplus in long
Declare long GdipCreateBitmapFromFile gdiplus in string, long @
Declare long GdipCreateHICONFromBitmap gdiplus in long, long @
Declare long GdipDisposeImage gdiplus in long
Store 0 to oImage, hImage
M.h Token=0
M.i InputBuf=0 h01-2 + REPLICATE (CRH (0), 15)
GdiplusStartup (@ hToken iInputBuf, 0)
GdipCreateBitmapFromFile (STRCONV (cTempFileName + CRH (0), 5), @ oImage)
GdipCreateHICONFromBitmap (oImage, @ hImage)
GdipDisposeImage (oImage)
GdiplusShutdown (m.h Token)

CodePudding user response:

The code logic is too messy, really didn't understand what you want to achieve function

CodePudding user response:

Is to remove the icon from the IMAGELIST control and saved as icon file,

CodePudding user response:

Code is put together, including the part still borrowing your code below,

CodePudding user response:

You can run is not an error code? The first paragraph is used to extract icon file, what is called "extracted a fake ICO file"?
As long as correct statement gdiplus function, extracted is true icon file, executable code should be like this:
 Declare long GdiplusStartup in GDIPlus long @, string, long @ 
Declare long GdiplusShutdown GDIPlus in long
Declare Long GdipCreateBitmapFromHICON GDIPlus in Long, Long @
Declare Long GdipSaveImageToFile GDIPlus In Long, String, String, Long
Declare long GdipDisposeImage GDIPlus in long

* - the it ourselves -
M.o on Iml=Thisform. Olecontrol1
M.i I=2
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

M.h Token=0
M.i InputBuf=CRH (1) + Replicate (CRH (0), 15)
GdiplusStartup (@ hToken iInputBuf, 0)

M.c Enc_ico=0 h00f47c55041ad3119a730000f81ef32e
M.h Bmp=0
If 0==GdipCreateBitmapFromHICON (m.o on Iml. ListImages (m.i I) ExtractIcon (). The Handle, @ m.h Bmp)
M.c File="TTT. Ico"
If 0==GdipSaveImageToFile (m.h Bmp, Strconv (m.c File + CRH (0), 5), m.c Enc_ico, 0)
? 'ok,' + FullPath (m.c File)
The Else
? 'error'
Endif
GdipDisposeImage m.h (Bmp)
The Else
? 'error'
Endif
GdiplusShutdown (m.h Token)

CodePudding user response:

A little busy these days, sorry I didn't come today, thanks to the teacher's reply, I test the later,

CodePudding user response:

New problems come, again to ask the teacher, I remove the icon from IMAGELIST is not the original image is not clear, if take out the artwork?

CodePudding user response:

This can't, ImageList to joining the image has been processed, stored images are a zoom, unable to restore

CodePudding user response:

reference 4 floor DKFDTF response:
you this code can run is not an error? The first paragraph is used to extract icon file, what is called "extracted a fake ICO file"?
As long as correct statement gdiplus function, extracted is true icon file, executable code should be like this:
 Declare long GdiplusStartup in GDIPlus long @, string, long @ 
Declare long GdiplusShutdown GDIPlus in long
Declare Long GdipCreateBitmapFromHICON GDIPlus in Long, Long @
Declare Long GdipSaveImageToFile GDIPlus In Long, String, String, Long
Declare long GdipDisposeImage GDIPlus in long

* - the it ourselves -
M.o on Iml=Thisform. Olecontrol1
M.i I=2
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

M.h Token=0
M.i InputBuf=CRH (1) + Replicate (CRH (0), 15)
GdiplusStartup (@ hToken iInputBuf, 0)

M.c Enc_ico=0 h00f47c55041ad3119a730000f81ef32e
M.h Bmp=0
If 0==GdipCreateBitmapFromHICON (m.o on Iml. ListImages (m.i I) ExtractIcon (). The Handle, @ m.h Bmp)
M.c File="TTT. Ico"
If 0==GdipSaveImageToFile (m.h Bmp, Strconv (m.c File + CRH (0), 5), m.c Enc_ico, 0)
? 'ok,' + FullPath (m.c File)
The Else
? 'error'
Endif
GdipDisposeImage m.h (Bmp)
The Else
? 'error'
Endif
GdiplusShutdown (m.h Token)


Mark,
  •  Tags:  
  • VFP
  • Related