Commit a8c54fb8 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

OleMetaFilePictFromIconAndLabel16: slightly broken, use LPOLESTR16.

parent 8f3c0a37
...@@ -2110,37 +2110,37 @@ static void OLEUTL_ReadRegistryDWORDValue( ...@@ -2110,37 +2110,37 @@ static void OLEUTL_ReadRegistryDWORDValue(
* If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex. * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex.
* This code might be wrong at some places. * This code might be wrong at some places.
*/ */
HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(HICON hIcon, LPOLESTR lpszLabel, LPOLESTR lpszSourceFile, UINT16 iIconIndex) HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
{ HICON16 hIcon,
LPCOLESTR16 lpszLabel,
LPCOLESTR16 lpszSourceFile,
UINT16 iIconIndex
) {
METAFILEPICT16 *mf; METAFILEPICT16 *mf;
HGLOBAL16 hmf; HGLOBAL16 hmf;
HDC16 hdc; HDC16 hdc;
FIXME(ole, "(%04x, '%s', '%s', %d): incorrect metrics, please try to correct them !\n\n\n", hIcon, (LPCSTR)lpszLabel, (LPCSTR)lpszSourceFile, iIconIndex); FIXME(ole, "(%04x, '%s', '%s', %d): incorrect metrics, please try to correct them !\n\n\n", hIcon, lpszLabel, lpszSourceFile, iIconIndex);
if (!hIcon) { if (!hIcon) {
if (lpszSourceFile) { if (lpszSourceFile) {
HINSTANCE16 hInstance = LoadLibrary16((LPCSTR)lpszSourceFile); HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
/* load the icon at index from lpszSourceFile */
hIcon = (HICON16)LoadIconA(hInstance, (LPCSTR)(DWORD)iIconIndex);
FreeLibrary16(hInstance); /* load the icon at index from lpszSourceFile */
} else hIcon = (HICON16)LoadIconA(hInstance, (LPCSTR)(DWORD)iIconIndex);
return (HGLOBAL)NULL; FreeLibrary16(hInstance);
} else
return (HGLOBAL)NULL;
} }
hdc = CreateMetaFile16(NULL); hdc = CreateMetaFile16(NULL);
DrawIcon(hdc, 0, 0, hIcon); /* FIXME */ DrawIcon(hdc, 0, 0, hIcon); /* FIXME */
TextOut16(hdc, 0, 0, (LPCSTR)lpszLabel, 1); /* FIXME */ TextOut16(hdc, 0, 0, lpszLabel, 1); /* FIXME */
hmf = GlobalAlloc16(0, sizeof(METAFILEPICT16));
hmf = GlobalAlloc16(0, sizeof(METAFILEPICT16)); mf = (METAFILEPICT16 *)GlobalLock16(hmf);
mf = (METAFILEPICT16 *)GlobalLock16(hmf); mf->mm = MM_ANISOTROPIC;
mf->xExt = 20; /* FIXME: bogus */
mf->mm = MM_ANISOTROPIC; mf->yExt = 20; /* dito */
mf->xExt = 20; /* FIXME: bogus */
mf->yExt = 20; /* dito */
mf->hMF = CloseMetaFile16(hdc); mf->hMF = CloseMetaFile16(hdc);
return hmf; return hmf;
} }
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