[2/2] gdiplus: added GdipCreateHICONFromBitmap

Nikolay Sivov bunglehead at gmail.com
Sat Dec 6 16:23:09 CST 2008


Changelog:
    - added GdipCreateHICONFromBitmap

>From 11597e811be206140e2bab68554231a0cc067df3 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sun, 7 Dec 2008 01:18:41 +0300
Subject:  added GdipCreateHICONFromBitmap

---
 dlls/gdiplus/gdiplus.spec |    2 +-
 dlls/gdiplus/image.c      |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 70e4dc7..891eece 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -94,7 +94,7 @@
 @ stdcall GdipCreateFromHWND(long ptr)
 @ stdcall GdipCreateFromHWNDICM(long ptr)
 @ stdcall GdipCreateHBITMAPFromBitmap(ptr ptr long)
-@ stub GdipCreateHICONFromBitmap
+@ stdcall GdipCreateHICONFromBitmap(ptr ptr)
 @ stdcall GdipCreateHalftonePalette()
 @ stub GdipCreateHatchBrush
 @ stdcall GdipCreateImageAttributes(ptr)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index bdd28fc..c3e08bd 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -624,6 +624,33 @@ GpStatus WINGDIPAPI GdipCreateCachedBitmap(GpBitmap *bitmap, GpGraphics *graphic
     return Ok;
 }
 
+GpStatus WINGDIPAPI GdipCreateHICONFromBitmap(GpBitmap* bitmap, HICON* hicon)
+{
+    OLE_HANDLE handle;
+    HICON ret;
+    short type;
+
+    TRACE("%p %p\n", bitmap, hicon);
+
+    if(!bitmap || !hicon)
+        return InvalidParameter;
+
+    IPicture_get_Type(bitmap->image.picture, &type);
+
+    if(type != PICTYPE_ICON)
+        return InvalidParameter;
+
+    IPicture_get_Handle(bitmap->image.picture, &handle);
+    if(!handle)
+        return GenericError;
+
+    ret = DuplicateIcon(NULL, (HICON)handle);
+    if(ret)
+        *hicon = ret;
+
+    return Ok;
+}
+
 GpStatus WINGDIPAPI GdipDeleteCachedBitmap(GpCachedBitmap *cachedbmp)
 {
     TRACE("%p\n", cachedbmp);
-- 
1.4.4.4






More information about the wine-patches mailing list