Commit 1048ebb3 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Semi-correct implementation of OleMetafilePictFromIconAndLabel.

parent 3b570864
......@@ -112,7 +112,7 @@
112 stdcall OleLoad(ptr ptr ptr ptr)
113 stdcall OleLoadFromStream(ptr ptr ptr)
114 stdcall OleLockRunning(ptr long long)
115 stub OleMetafilePictFromIconAndLabel
115 stdcall OleMetafilePictFromIconAndLabel(long ptr ptr long)
116 stub OleNoteObjectVisible
117 stdcall OleQueryCreateFromData(ptr)
118 stdcall OleQueryLinkFromData(ptr)
......
......@@ -20,6 +20,9 @@
#include "windef.h"
#include "winerror.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "ole32_main.h"
#include "wine/debug.h"
......@@ -28,9 +31,66 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
HINSTANCE OLE32_hInstance = 0;
/***********************************************************************
* DllMain (OLE32.@)
* OleMetafilePictFromIconAndLabel (OLE32.115)
*/
HGLOBAL WINAPI OleMetafilePictFromIconAndLabel(HICON hIcon, LPOLESTR lpszLabel,
LPOLESTR lpszSourceFile, UINT iIconIndex)
{
HMETAFILE hmf;
HDC hdc;
UINT dy, mfsize;
HGLOBAL hmem = 0;
LPVOID mfdata;
TRACE("%p %p %p %d\n", hIcon, lpszLabel, lpszSourceFile, iIconIndex);
if( !hIcon )
return 0;
hdc = CreateMetaFileW(NULL);
if( !hdc )
return 0;
/* FIXME: things are drawn in the wrong place */
DrawIcon(hdc, 0, 0, hIcon);
dy = GetSystemMetrics(SM_CXICON);
if(lpszLabel)
TextOutW(hdc, 0, dy, lpszLabel, lstrlenW(lpszLabel));
hmf = CloseMetaFile(hdc);
if( !hmf )
return 0;
mfsize = GetMetaFileBitsEx( hmf, 0, NULL);
if( !mfsize )
goto end;
hmem = GlobalAlloc( GMEM_MOVEABLE, mfsize );
if( !hmem )
goto end;
mfdata = GlobalLock( hmem );
if( !mfdata )
{
GlobalFree( hmem );
hmem = 0;
goto end;
}
GetMetaFileBitsEx( hmf, mfsize, mfdata );
GlobalUnlock( hmem );
end:
DeleteMetaFile(hmf);
TRACE("returning %p\n",hmem);
return hmem;
}
/***********************************************************************
* DllMain (OLE32.@)
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
{
TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment