- Fixed passing of integer named controls in dialogs. Previously an integer was passed directly to CreateWindowEx, but that could not work, because it treats it as a string. After reading Microsoft documentation the correct way is to pass a string in form "#num".

- Fixed getting of integer names in STATIC control. Is this the right place?
- Fixed icon support in STATIC control.

svn path=/trunk/; revision=6478
This commit is contained in:
Filip Navara 2003-10-31 16:25:08 +00:00
parent c3b4b58a78
commit 65a44fd9e2
3 changed files with 49 additions and 9 deletions

View file

@ -1,4 +1,4 @@
/* $Id: static.c,v 1.7 2003/09/11 22:10:16 gvg Exp $
/* $Id: static.c,v 1.8 2003/10/31 16:25:08 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS User32
@ -93,8 +93,27 @@ static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
}
return prevIcon;
#else
OutputDebugStringA("STATIC_SetIcon not implemented\n");
return NULL;
HICON prevIcon;
if ((style & SS_TYPEMASK) != SS_ICON) return 0;
prevIcon = (HICON)SetWindowLongA( hwnd, HICON_GWL_OFFSET, (LONG)hicon );
if (hicon)
{
ICONINFO info;
SIZE bitmapSize;
if (!GetIconInfo(hicon, &info))
{
return 0;
}
if (!GetBitmapDimensionEx(info.hbmColor, &bitmapSize))
{
return 0;
}
SetWindowPos( hwnd, 0, 0, 0, bitmapSize.cx, bitmapSize.cy,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
}
return prevIcon;
#endif
}
@ -237,6 +256,17 @@ static LRESULT CALLBACK StaticWndProcW( HWND hwnd, UINT uMsg, WPARAM wParam, LPA
lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName);
/* fall through */
case WM_SETTEXT:
if ((LPWSTR)lParam != NULL && ((LPWSTR)lParam)[0] == '#')
{
ULONG resource = 0, i;
LPWSTR name = (LPWSTR)lParam;
for (i = 1; name[i] != 0; ++i)
{
resource *= 10;
resource += name[i] - '0';
}
name = (LPWSTR)resource;
}
switch (style) {
case SS_ICON:
{

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dialog.c,v 1.19 2003/09/20 19:52:23 gvg Exp $
/* $Id: dialog.c,v 1.20 2003/10/31 16:25:08 navaraf Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/dialog.c
@ -84,6 +84,7 @@ typedef struct
UINT id;
LPCWSTR className;
LPCWSTR windowName;
BOOL windowNameFree;
LPCVOID data;
} DLG_CONTROL_INFO;
@ -267,12 +268,15 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
if (GET_WORD(p) == 0xffff) /* Is it an integer id? */
{
info->windowName = (LPCWSTR)(UINT)GET_WORD(p + 1);
info->windowName = HeapAlloc( GetProcessHeap(), 0, 10 );
swprintf((LPWSTR)info->windowName, L"#%d", GET_WORD(p + 1));
info->windowNameFree = TRUE;
p += 2;
}
else
{
info->windowName = (LPCWSTR)p;
info->windowNameFree = FALSE;
p += wcslen( info->windowName ) + 1;
}
@ -353,6 +357,12 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL
if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
}
if (info.windowNameFree)
{
HeapFree( GetProcessHeap(), 0, (LPVOID)info.windowName );
}
if (!hwndCtrl)
{
if (dlgTemplate->style & DS_NOFAILCREATE) continue;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: messagebox.c,v 1.20 2003/10/12 10:05:22 weiden Exp $
/* $Id: messagebox.c,v 1.21 2003/10/31 16:25:08 navaraf Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/messagebox.c
@ -737,13 +737,13 @@ MessageBoxIndirectA(
ret = MessageBoxTimeoutIndirectW(&msgboxW, (UINT)-1);
if (HIWORD(textW.Buffer))
if (HIWORD((UINT)lpMsgBoxParams->lpszText))
RtlFreeUnicodeString(&textW);
if (HIWORD(captionW.Buffer))
if (HIWORD((UINT)lpMsgBoxParams->lpszCaption))
RtlFreeUnicodeString(&captionW);
if (HIWORD(iconW.Buffer))
if (HIWORD((UINT)lpMsgBoxParams->lpszIcon))
RtlFreeUnicodeString(&iconW);
return ret;