Hi
My question is:
How to save an ICON to Disk using icon handle.
my code is this:
.const
szFileName DB "C:\app.exe",0
.data?
hInstance dd ?
hIcon1 dd ?; // icon handle
hdc1 dd ?; // handle of display context
.
.
.
invoke ExtractIcon,hInstance,offset szFileName,0
mov hIcon1,eax
invoke GetDC,hWin
mov hdc1,eax
invoke DrawIcon,hdc1, 10, 20, hIcon1
I have got the HICON and assigned to hdc1 ,but have to save to harddisk? ::)
any help or hint will be appreciated.
I think you have to use GetDIBits to get a buffer with the actual bitmap bits. I'm not sure how it should be saved to disk (don't know about the bmp format)
You may need to load the handle with LoadImage. Can you at least show the ico correctly at the moment ? Leave the disk saving for last.
invoke DrawIcon,hdc1, 10, 20, hIcon1
with this code the main form which has hWin handle,And yes it draws and shows the icon in the Form.
I have the handle of ICON on app.exe which is in other directory.
Ok, then get the bits with that function I mentioned.
Here is an solution with API: http://www.activevb.de/tipps/vb6tipps/tipp0729.html