오전 11:07 2002-11-29
HICON을 ico로 바꾸는 방법
==========================================================================

icon 포맷
Icons in Win32
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/msdn_icons.asp

vc 샘플
conPro: Icon Manager Sample 참조



vb에서

Dim hWnd As Long
Dim hIcon As Long
Dim path As String
path = "C:\icon.exe"

hWnd = GetWindowLong(Me.hWnd, GWL_HINSTANCE)

hIcon = ExtractIcon(hWnd, path, 1)

Picture1.AutoRedraw = True

DrawIcon Picture1.hdc, 0, 0, hIcon

SavePicture Picture1.Image, "C:\icon.bmp"



IPicture 이용

One way =>

OleCreatePictureIndirect() with PICTDESC.icon.hicon = hIcon =>
IPicture
StgCreateDocfile()
CreateStream()
IPicture->SaveAsFile
// ... don't forget all Release()...

Then you read the temporary Stream =>
StgOpenStorage()
Stat() for .ICO size.
OpenStream()
GlobalAlloc()
GlobalLock()
Read()
CreateFile()-WriteFile()-CloseHandle()
GlobalUnlock()
GloBalFree()

+ Recent posts