user32: Move loading of static icons for 16-bit windows to the 16-bit wrapper.
This commit is contained in:
parent
fadc2cda1c
commit
b96ab35cad
|
@ -2594,6 +2594,33 @@ static LRESULT static_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
|||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
{
|
||||
CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam;
|
||||
LRESULT ret = wow_handlers32.static_proc( hwnd, msg, wParam, lParam, unicode );
|
||||
|
||||
if (!ret) return 0;
|
||||
if (((ULONG_PTR)cs->hInstance >> 16)) return ret; /* 32-bit instance, nothing to do */
|
||||
switch (cs->style & SS_TYPEMASK)
|
||||
{
|
||||
case SS_ICON:
|
||||
{
|
||||
HICON16 icon = LoadIcon16( HINSTANCE_16(cs->hInstance), cs->lpszName );
|
||||
if (!icon) icon = LoadCursor16( HINSTANCE_16(cs->hInstance), cs->lpszName );
|
||||
if (icon) wow_handlers32.static_proc( hwnd, STM_SETIMAGE, IMAGE_ICON,
|
||||
(LPARAM)HICON_32(icon), FALSE );
|
||||
break;
|
||||
}
|
||||
case SS_BITMAP:
|
||||
{
|
||||
HBITMAP16 bitmap = LoadBitmap16( HINSTANCE_16(cs->hInstance), cs->lpszName );
|
||||
if (bitmap) wow_handlers32.static_proc( hwnd, STM_SETIMAGE, IMAGE_BITMAP,
|
||||
(LPARAM)HBITMAP_32(bitmap), FALSE );
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
case STM_SETICON16:
|
||||
wParam = (WPARAM)HICON_32( (HICON16)wParam );
|
||||
return wow_handlers32.static_proc( hwnd, STM_SETICON, wParam, lParam, FALSE );
|
||||
|
|
|
@ -256,72 +256,52 @@ static HANDLE STATIC_GetImage( HWND hwnd, WPARAM wParam, DWORD style )
|
|||
*
|
||||
* Load the icon for an SS_ICON control.
|
||||
*/
|
||||
static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name, DWORD style )
|
||||
static HICON STATIC_LoadIconA( HINSTANCE hInstance, LPCSTR name, DWORD style )
|
||||
{
|
||||
HICON hicon;
|
||||
|
||||
if (hInstance && ((ULONG_PTR)hInstance >> 16))
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
|
||||
if ((style & SS_REALSIZEIMAGE) != 0)
|
||||
{
|
||||
return LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
|
||||
}
|
||||
hicon = LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
|
||||
else
|
||||
{
|
||||
HICON hicon = LoadIconA( hInstance, name );
|
||||
hicon = LoadIconA( hInstance, name );
|
||||
if (!hicon) hicon = LoadCursorA( hInstance, name );
|
||||
}
|
||||
}
|
||||
if (!hicon) hicon = LoadIconA( 0, name );
|
||||
/* Windows doesn't try to load a standard cursor,
|
||||
probably because most IDs for standard cursors conflict
|
||||
with the IDs for standard icons anyway */
|
||||
return hicon;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* STATIC_LoadIconW
|
||||
*
|
||||
* Load the icon for an SS_ICON control.
|
||||
*/
|
||||
static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name, DWORD style )
|
||||
static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style )
|
||||
{
|
||||
HICON hicon;
|
||||
|
||||
if (hInstance && ((ULONG_PTR)hInstance >> 16))
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
|
||||
if ((style & SS_REALSIZEIMAGE) != 0)
|
||||
{
|
||||
return LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
|
||||
}
|
||||
hicon = LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
|
||||
else
|
||||
{
|
||||
HICON hicon = LoadIconW( hInstance, name );
|
||||
hicon = LoadIconW( hInstance, name );
|
||||
if (!hicon) hicon = LoadCursorW( hInstance, name );
|
||||
}
|
||||
}
|
||||
if (!hicon) hicon = LoadIconW( 0, name );
|
||||
/* Windows doesn't try to load a standard cursor,
|
||||
probably because most IDs for standard cursors conflict
|
||||
with the IDs for standard icons anyway */
|
||||
return hicon;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* STATIC_LoadBitmapA
|
||||
*
|
||||
* Load the bitmap for an SS_BITMAP control.
|
||||
*/
|
||||
static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name )
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
|
||||
/* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */
|
||||
return LoadBitmapA( hInstance, name );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* STATIC_LoadBitmapW
|
||||
*
|
||||
* Load the bitmap for an SS_BITMAP control.
|
||||
*/
|
||||
static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name )
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
|
||||
/* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */
|
||||
return LoadBitmapW( hInstance, name );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* STATIC_TryPaintFcn
|
||||
|
@ -471,42 +451,31 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
|
||||
case WM_NCCREATE:
|
||||
{
|
||||
LPCSTR textA;
|
||||
LPCWSTR textW;
|
||||
CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
|
||||
|
||||
if (full_style & SS_SUNKEN)
|
||||
SetWindowLongW( hwnd, GWL_EXSTYLE,
|
||||
GetWindowLongW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
|
||||
|
||||
if(unicode)
|
||||
{
|
||||
textA = NULL;
|
||||
textW = ((LPCREATESTRUCTW)lParam)->lpszName;
|
||||
}
|
||||
else
|
||||
{
|
||||
textA = ((LPCREATESTRUCTA)lParam)->lpszName;
|
||||
textW = NULL;
|
||||
}
|
||||
|
||||
switch (style) {
|
||||
case SS_ICON:
|
||||
{
|
||||
HICON hIcon;
|
||||
if(unicode)
|
||||
hIcon = STATIC_LoadIconW(hwnd, textW, full_style);
|
||||
if (unicode || IS_INTRESOURCE(cs->lpszName))
|
||||
hIcon = STATIC_LoadIconW(cs->hInstance, cs->lpszName, full_style);
|
||||
else
|
||||
hIcon = STATIC_LoadIconA(hwnd, textA, full_style);
|
||||
hIcon = STATIC_LoadIconA(cs->hInstance, (LPCSTR)cs->lpszName, full_style);
|
||||
STATIC_SetIcon(hwnd, hIcon, full_style);
|
||||
}
|
||||
break;
|
||||
case SS_BITMAP:
|
||||
if ((ULONG_PTR)cs->hInstance >> 16)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
if(unicode)
|
||||
hBitmap = STATIC_LoadBitmapW(hwnd, textW);
|
||||
if (unicode || IS_INTRESOURCE(cs->lpszName))
|
||||
hBitmap = LoadBitmapW(cs->hInstance, cs->lpszName);
|
||||
else
|
||||
hBitmap = STATIC_LoadBitmapA(hwnd, textA);
|
||||
hBitmap = LoadBitmapA(cs->hInstance, (LPCSTR)cs->lpszName);
|
||||
STATIC_SetBitmap(hwnd, hBitmap, full_style);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue