user32: Move 16-bit window creation functions to 16-bit files.

This commit is contained in:
Alexandre Julliard 2009-12-17 15:03:32 +01:00
parent 4b3c0e31d0
commit 8494682f2d
6 changed files with 85 additions and 82 deletions

View File

@ -98,6 +98,7 @@ struct wow_handlers32
LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
HWND (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,UINT);
WNDPROC (*alloc_winproc)(WNDPROC,WNDPROC);
};

View File

@ -2002,6 +2002,73 @@ BOOL16 WINAPI TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg )
}
/***********************************************************************
* CreateWindowEx (USER.452)
*/
HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
LPCSTR windowName, DWORD style, INT16 x,
INT16 y, INT16 width, INT16 height,
HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, LPVOID data )
{
CREATESTRUCTA cs;
char buffer[256];
HWND hwnd;
/* Fix the coordinates */
cs.x = (x == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)x;
cs.y = (y == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)y;
cs.cx = (width == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)width;
cs.cy = (height == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)height;
/* Create the window */
cs.lpCreateParams = data;
cs.hInstance = HINSTANCE_32(instance);
cs.hMenu = HMENU_32(menu);
cs.hwndParent = WIN_Handle32( parent );
cs.style = style;
cs.lpszName = windowName;
cs.lpszClass = className;
cs.dwExStyle = exStyle;
/* map to module handle */
if (instance) instance = GetExePtr( instance );
/* load the menu */
if (!menu && (style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
{
WNDCLASSA class;
if (GetClassInfoA( HINSTANCE_32(instance), className, &class ))
cs.hMenu = HMENU_32( LoadMenu16( instance, class.lpszMenuName ));
}
if (!IS_INTRESOURCE(className))
{
WCHAR bufferW[256];
if (!MultiByteToWideChar( CP_ACP, 0, className, -1, bufferW, sizeof(bufferW)/sizeof(WCHAR) ))
return 0;
hwnd = wow_handlers32.create_window( (CREATESTRUCTW *)&cs, bufferW,
HINSTANCE_32(instance), 0 );
}
else
{
if (!GlobalGetAtomNameA( LOWORD(className), buffer, sizeof(buffer) ))
{
ERR( "bad atom %x\n", LOWORD(className));
return 0;
}
cs.lpszClass = buffer;
hwnd = wow_handlers32.create_window( (CREATESTRUCTW *)&cs, (LPCWSTR)className,
HINSTANCE_32(instance), 0 );
}
return HWND_16( hwnd );
}
/***********************************************************************
* button_proc16
*/

View File

@ -27,9 +27,6 @@
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "wownt32.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "win.h"
@ -884,7 +881,7 @@ void WIN_DestroyThreadWindows( HWND hwnd )
*/
static void WIN_FixCoordinates( CREATESTRUCTW *cs, INT *sw)
{
#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == CW_USEDEFAULT16)
#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == (SHORT)0x8000)
POINT pos[2];
if (cs->dwExStyle & WS_EX_MDICHILD)
@ -1072,7 +1069,7 @@ static void dump_window_styles( DWORD style, DWORD exstyle )
*
* Implementation of CreateWindowEx().
*/
static HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags )
HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags )
{
INT cx, cy, style, sw = SW_SHOW;
LRESULT result;
@ -1439,83 +1436,6 @@ failed:
}
/***********************************************************************
* CreateWindow (USER.41)
*/
HWND16 WINAPI CreateWindow16( LPCSTR className, LPCSTR windowName,
DWORD style, INT16 x, INT16 y, INT16 width,
INT16 height, HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, LPVOID data )
{
return CreateWindowEx16( 0, className, windowName, style,
x, y, width, height, parent, menu, instance, data );
}
/***********************************************************************
* CreateWindowEx (USER.452)
*/
HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
LPCSTR windowName, DWORD style, INT16 x,
INT16 y, INT16 width, INT16 height,
HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, LPVOID data )
{
CREATESTRUCTA cs;
char buffer[256];
/* Fix the coordinates */
cs.x = (x == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)x;
cs.y = (y == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)y;
cs.cx = (width == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)width;
cs.cy = (height == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)height;
/* Create the window */
cs.lpCreateParams = data;
cs.hInstance = HINSTANCE_32(instance);
cs.hMenu = HMENU_32(menu);
cs.hwndParent = WIN_Handle32( parent );
cs.style = style;
cs.lpszName = windowName;
cs.lpszClass = className;
cs.dwExStyle = exStyle;
/* map to module handle */
if (instance) instance = GetExePtr( instance );
/* load the menu */
if (!menu && (style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
{
WNDCLASSA class;
if (GetClassInfoA( HINSTANCE_32(instance), className, &class ))
cs.hMenu = HMENU_32( LoadMenu16( instance, class.lpszMenuName ));
}
if (!IS_INTRESOURCE(className))
{
WCHAR bufferW[256];
if (!MultiByteToWideChar( CP_ACP, 0, className, -1, bufferW, sizeof(bufferW)/sizeof(WCHAR) ))
return 0;
return HWND_16( WIN_CreateWindowEx( (CREATESTRUCTW *)&cs, bufferW, HINSTANCE_32(instance), 0 ));
}
else
{
if (!GlobalGetAtomNameA( LOWORD(className), buffer, sizeof(buffer) ))
{
ERR( "bad atom %x\n", LOWORD(className));
return 0;
}
cs.lpszClass = buffer;
return HWND_16( WIN_CreateWindowEx( (CREATESTRUCTW *)&cs, (LPCWSTR)className,
HINSTANCE_32(instance), 0 ));
}
}
/***********************************************************************
* CreateWindowExA (USER32.@)
*/

View File

@ -87,6 +87,7 @@ extern ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPE
extern BOOL WIN_GetRectangles( HWND hwnd, RECT *rectWindow, RECT *rectClient ) DECLSPEC_HIDDEN;
extern LRESULT WIN_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN;
extern void WIN_DestroyThreadWindows( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags ) DECLSPEC_HIDDEN;
extern BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL ) DECLSPEC_HIDDEN;
extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN;
extern LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOOL unicode ) DECLSPEC_HIDDEN;

View File

@ -1135,6 +1135,7 @@ void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wo
orig->mdiclient_proc = MDIClientWndProc_common;
orig->scrollbar_proc = ScrollBarWndProc_common;
orig->static_proc = StaticWndProc_common;
orig->create_window = WIN_CreateWindowEx;
orig->alloc_winproc = WINPROC_AllocProc;
wow_handlers = *new;

View File

@ -305,6 +305,19 @@ BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
}
/***********************************************************************
* CreateWindow (USER.41)
*/
HWND16 WINAPI CreateWindow16( LPCSTR className, LPCSTR windowName,
DWORD style, INT16 x, INT16 y, INT16 width,
INT16 height, HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, LPVOID data )
{
return CreateWindowEx16( 0, className, windowName, style,
x, y, width, height, parent, menu, instance, data );
}
/**************************************************************************
* ShowWindow (USER.42)
*/