2 * Default window procedure
4 * Copyright 1993, 1996 Alexandre Julliard
14 #include "nonclient.h"
17 #include "debugtools.h"
24 #include "wine/unicode.h"
25 #include "wine/winuser16.h"
27 DEFAULT_DEBUG_CHANNEL(win
);
29 /* bits in the dwKeyData */
30 #define KEYDATA_ALT 0x2000
31 #define KEYDATA_PREVSTATE 0x4000
33 static short iF10Key
= 0;
34 static short iMenuSysKey
= 0;
36 /***********************************************************************
37 * DEFWND_HandleWindowPosChanged
39 * Handle the WM_WINDOWPOSCHANGED message.
41 static void DEFWND_HandleWindowPosChanged( WND
*wndPtr
, UINT flags
)
43 WPARAM16 wp
= SIZE_RESTORED
;
45 if (!(flags
& SWP_NOCLIENTMOVE
))
46 SendMessage16( wndPtr
->hwndSelf
, WM_MOVE
, 0,
47 MAKELONG(wndPtr
->rectClient
.left
, wndPtr
->rectClient
.top
));
48 if (!(flags
& SWP_NOCLIENTSIZE
))
50 if (wndPtr
->dwStyle
& WS_MAXIMIZE
) wp
= SIZE_MAXIMIZED
;
51 else if (wndPtr
->dwStyle
& WS_MINIMIZE
) wp
= SIZE_MINIMIZED
;
53 SendMessage16( wndPtr
->hwndSelf
, WM_SIZE
, wp
,
54 MAKELONG(wndPtr
->rectClient
.right
-wndPtr
->rectClient
.left
,
55 wndPtr
->rectClient
.bottom
-wndPtr
->rectClient
.top
));
60 /***********************************************************************
63 * Set the window text.
65 void DEFWND_SetTextA( WND
*wndPtr
, LPCSTR text
)
70 count
= MultiByteToWideChar( CP_ACP
, 0, text
, -1, NULL
, 0 );
72 if (wndPtr
->text
) HeapFree(SystemHeap
, 0, wndPtr
->text
);
73 if ((wndPtr
->text
= HeapAlloc(SystemHeap
, 0, count
* sizeof(WCHAR
))))
74 MultiByteToWideChar( CP_ACP
, 0, text
, -1, wndPtr
->text
, count
);
76 ERR("Not enough memory for window text");
78 wndPtr
->pDriver
->pSetText(wndPtr
, wndPtr
->text
);
81 /***********************************************************************
84 * Set the window text.
86 void DEFWND_SetTextW( WND
*wndPtr
, LPCWSTR text
)
88 static const WCHAR empty_string
[] = {0};
91 if (!text
) text
= empty_string
;
92 count
= strlenW(text
) + 1;
94 if (wndPtr
->text
) HeapFree(SystemHeap
, 0, wndPtr
->text
);
95 if ((wndPtr
->text
= HeapAlloc(SystemHeap
, 0, count
* sizeof(WCHAR
))))
96 strcpyW( wndPtr
->text
, text
);
98 ERR("Not enough memory for window text");
100 wndPtr
->pDriver
->pSetText(wndPtr
, wndPtr
->text
);
103 /***********************************************************************
104 * DEFWND_ControlColor
106 * Default colors for control painting.
108 HBRUSH
DEFWND_ControlColor( HDC hDC
, UINT16 ctlType
)
110 if( ctlType
== CTLCOLOR_SCROLLBAR
)
112 HBRUSH hb
= GetSysColorBrush(COLOR_SCROLLBAR
);
113 if (TWEAK_WineLook
== WIN31_LOOK
) {
114 SetTextColor( hDC
, RGB(0, 0, 0) );
115 SetBkColor( hDC
, RGB(255, 255, 255) );
117 COLORREF bk
= GetSysColor(COLOR_3DHILIGHT
);
118 SetTextColor( hDC
, GetSysColor(COLOR_3DFACE
));
119 SetBkColor( hDC
, bk
);
121 /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
122 * we better use 0x55aa bitmap brush to make scrollbar's background
123 * look different from the window background.
125 if (bk
== GetSysColor(COLOR_WINDOW
)) {
126 return CACHE_GetPattern55AABrush();
129 UnrealizeObject( hb
);
133 SetTextColor( hDC
, GetSysColor(COLOR_WINDOWTEXT
));
135 if (TWEAK_WineLook
> WIN31_LOOK
) {
136 if ((ctlType
== CTLCOLOR_EDIT
) || (ctlType
== CTLCOLOR_LISTBOX
))
137 SetBkColor( hDC
, GetSysColor(COLOR_WINDOW
) );
139 SetBkColor( hDC
, GetSysColor(COLOR_3DFACE
) );
140 return GetSysColorBrush(COLOR_3DFACE
);
144 SetBkColor( hDC
, GetSysColor(COLOR_WINDOW
) );
145 return GetSysColorBrush(COLOR_WINDOW
);
149 /***********************************************************************
152 static void DEFWND_SetRedraw( WND
* wndPtr
, WPARAM wParam
)
154 BOOL bVisible
= wndPtr
->dwStyle
& WS_VISIBLE
;
156 TRACE("%04x %i\n", wndPtr
->hwndSelf
, (wParam
!=0) );
162 wndPtr
->dwStyle
|= WS_VISIBLE
;
163 DCE_InvalidateDCE( wndPtr
, &wndPtr
->rectWindow
);
168 if( wndPtr
->dwStyle
& WS_MINIMIZE
) wParam
= RDW_VALIDATE
;
169 else wParam
= RDW_ALLCHILDREN
| RDW_VALIDATE
;
171 PAINT_RedrawWindow( wndPtr
->hwndSelf
, NULL
, 0, wParam
, 0 );
172 DCE_InvalidateDCE( wndPtr
, &wndPtr
->rectWindow
);
173 wndPtr
->dwStyle
&= ~WS_VISIBLE
;
177 /***********************************************************************
180 * This method handles the default behavior for the WM_PRINT message.
182 static void DEFWND_Print(
190 if ( (uFlags
& PRF_CHECKVISIBLE
) &&
191 !IsWindowVisible(wndPtr
->hwndSelf
) )
195 * Unimplemented flags.
197 if ( (uFlags
& PRF_CHILDREN
) ||
198 (uFlags
& PRF_OWNED
) ||
199 (uFlags
& PRF_NONCLIENT
) )
201 WARN("WM_PRINT message with unsupported flags\n");
207 if ( uFlags
& PRF_ERASEBKGND
)
208 SendMessageA(wndPtr
->hwndSelf
, WM_ERASEBKGND
, (WPARAM
)hdc
, 0);
213 if ( uFlags
& PRF_CLIENT
)
214 SendMessageA(wndPtr
->hwndSelf
, WM_PRINTCLIENT
, (WPARAM
)hdc
, PRF_CLIENT
);
217 /***********************************************************************
220 * Default window procedure for messages that are the same in Win16 and Win32.
222 static LRESULT
DEFWND_DefWinProc( WND
*wndPtr
, UINT msg
, WPARAM wParam
,
228 return NC_HandleNCPaint( wndPtr
->hwndSelf
, (HRGN
)wParam
);
233 pt
.x
= SLOWORD(lParam
);
234 pt
.y
= SHIWORD(lParam
);
235 return NC_HandleNCHitTest( wndPtr
->hwndSelf
, pt
);
238 case WM_NCLBUTTONDOWN
:
239 return NC_HandleNCLButtonDown( wndPtr
, wParam
, lParam
);
241 case WM_LBUTTONDBLCLK
:
242 case WM_NCLBUTTONDBLCLK
:
243 return NC_HandleNCLButtonDblClk( wndPtr
, wParam
, lParam
);
245 case WM_NCRBUTTONDOWN
:
246 /* in Windows, capture is taken when right-clicking on the caption bar */
247 if (wParam
==HTCAPTION
)
249 SetCapture(wndPtr
->hwndSelf
);
254 if (wndPtr
->hwndSelf
== GetCapture())
256 /* release capture if we took it on WM_NCRBUTTONDOWN */
259 if ((wndPtr
->flags
& WIN_ISWIN32
) || (TWEAK_WineLook
> WIN31_LOOK
))
261 ClientToScreen16(wndPtr
->hwndSelf
, (LPPOINT16
)&lParam
);
262 SendMessageA( wndPtr
->hwndSelf
, WM_CONTEXTMENU
,
263 wndPtr
->hwndSelf
, lParam
);
269 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
270 * in Windows), but what _should_ we do? According to MSDN :
271 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
272 * message to the window". When is it appropriate?
277 if( wndPtr
->dwStyle
& WS_CHILD
)
278 SendMessageA( wndPtr
->parent
->hwndSelf
, msg
, wParam
, lParam
);
279 else if (wndPtr
->hSysMenu
)
283 pt
.x
= SLOWORD(lParam
);
284 pt
.y
= SHIWORD(lParam
);
287 * WM_CONTEXTMENU coordinates are relative to screen, but
288 * NC_HandleNCHitTest expects coordinates relative to the parent's
289 * client area (to compare with the rectangle returned by
293 ScreenToClient(wndPtr
->parent
->hwndSelf
, &pt
);
295 hitcode
= NC_HandleNCHitTest(wndPtr
->hwndSelf
, pt
);
297 /* Track system popup if click was in the caption area. */
298 if (hitcode
==HTCAPTION
|| hitcode
==HTSYSMENU
)
299 TrackPopupMenu(GetSystemMenu(wndPtr
->hwndSelf
, FALSE
),
300 TPM_LEFTBUTTON
| TPM_RIGHTBUTTON
,
301 pt
.x
, pt
.y
, 0, wndPtr
->hwndSelf
, NULL
);
306 return NC_HandleNCActivate( wndPtr
, wParam
);
309 if (wndPtr
->text
) HeapFree( SystemHeap
, 0, wndPtr
->text
);
311 if (wndPtr
->pVScroll
) HeapFree( SystemHeap
, 0, wndPtr
->pVScroll
);
312 if (wndPtr
->pHScroll
) HeapFree( SystemHeap
, 0, wndPtr
->pHScroll
);
313 wndPtr
->pVScroll
= wndPtr
->pHScroll
= NULL
;
317 DEFWND_Print(wndPtr
, (HDC
)wParam
, lParam
);
324 HDC16 hdc
= BeginPaint16( wndPtr
->hwndSelf
, &ps
);
327 if( (wndPtr
->dwStyle
& WS_MINIMIZE
) && wndPtr
->class->hIcon
)
329 int x
= (wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
-
330 GetSystemMetrics(SM_CXICON
))/2;
331 int y
= (wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
-
332 GetSystemMetrics(SM_CYICON
))/2;
333 TRACE("Painting class icon: vis rect=(%i,%i - %i,%i)\n",
334 ps
.rcPaint
.left
, ps
.rcPaint
.top
, ps
.rcPaint
.right
, ps
.rcPaint
.bottom
);
335 DrawIcon( hdc
, x
, y
, wndPtr
->class->hIcon
);
337 EndPaint16( wndPtr
->hwndSelf
, &ps
);
343 if (wndPtr
->hrgnUpdate
)
345 RedrawWindow ( wndPtr
->hwndSelf
, 0, wndPtr
->hrgnUpdate
,
346 RDW_ERASENOW
| RDW_ERASE
| RDW_FRAME
| RDW_ALLCHILDREN
);
351 DEFWND_SetRedraw( wndPtr
, wParam
);
355 DestroyWindow( wndPtr
->hwndSelf
);
358 case WM_MOUSEACTIVATE
:
359 if (wndPtr
->dwStyle
& WS_CHILD
)
361 LONG ret
= SendMessage16( wndPtr
->parent
->hwndSelf
,
362 WM_MOUSEACTIVATE
, wParam
, lParam
);
366 /* Caption clicks are handled by the NC_HandleNCLButtonDown() */
367 return (LOWORD(lParam
) >= HTCLIENT
) ? MA_ACTIVATE
: MA_NOACTIVATE
;
370 /* The default action in Windows is to set the keyboard focus to
371 * the window, if it's being activated and not minimized */
372 if (LOWORD(wParam
) != WA_INACTIVE
) {
373 if (!(wndPtr
->dwStyle
& WS_MINIMIZE
))
374 SetFocus(wndPtr
->hwndSelf
);
379 if (wndPtr
->dwStyle
& WS_CHILD
)
381 return SendMessageA( wndPtr
->parent
->hwndSelf
,
382 WM_MOUSEWHEEL
, wParam
, lParam
);
387 case WM_ICONERASEBKGND
:
391 if (!wndPtr
->class->hbrBackground
) return 0;
393 /* Since WM_ERASEBKGND may receive either a window dc or a */
394 /* client dc, the area to be erased has to be retrieved from */
395 /* the device context. */
396 GetClipBox( (HDC
)wParam
, &rect
);
398 /* Always call the Win32 variant of FillRect even on Win16,
399 * since despite the fact that Win16, as well as Win32,
400 * supports special background brushes for a window class,
401 * the Win16 variant of FillRect does not.
403 FillRect( (HDC
) wParam
, &rect
, wndPtr
->class->hbrBackground
);
410 case WM_CTLCOLORMSGBOX
:
411 case WM_CTLCOLOREDIT
:
412 case WM_CTLCOLORLISTBOX
:
415 case WM_CTLCOLORSTATIC
:
416 case WM_CTLCOLORSCROLLBAR
:
417 return (LRESULT
)DEFWND_ControlColor( (HDC
)wParam
, msg
- WM_CTLCOLORMSGBOX
);
420 return (LRESULT
)DEFWND_ControlColor( (HDC
)wParam
, HIWORD(lParam
) );
422 case WM_GETTEXTLENGTH
:
423 if (wndPtr
->text
) return (LRESULT
)strlenW(wndPtr
->text
);
427 if (wndPtr
->dwStyle
& WS_CHILD
)
428 if (SendMessage16(wndPtr
->parent
->hwndSelf
, WM_SETCURSOR
,
431 return NC_HandleSetCursor( wndPtr
->hwndSelf
, wParam
, lParam
);
436 pt
.x
= SLOWORD(lParam
);
437 pt
.y
= SHIWORD(lParam
);
438 return NC_HandleSysCommand( wndPtr
->hwndSelf
, wParam
, pt
);
442 if(wParam
== VK_F10
) iF10Key
= VK_F10
;
446 if( HIWORD(lParam
) & KEYDATA_ALT
)
448 /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
449 if( wParam
== VK_MENU
&& !iMenuSysKey
)
456 if( wParam
== VK_F4
) /* try to close the window */
458 HWND hWnd
= WIN_GetTopParent( wndPtr
->hwndSelf
);
459 wndPtr
= WIN_FindWndPtr( hWnd
);
460 if( wndPtr
&& !(wndPtr
->class->style
& CS_NOCLOSE
) )
461 PostMessage16( hWnd
, WM_SYSCOMMAND
, SC_CLOSE
, 0 );
462 WIN_ReleaseWndPtr(wndPtr
);
465 else if( wParam
== VK_F10
)
468 if( wParam
== VK_ESCAPE
&& (GetKeyState(VK_SHIFT
) & 0x8000))
469 SendMessage16( wndPtr
->hwndSelf
, WM_SYSCOMMAND
,
470 (WPARAM16
)SC_KEYMENU
, (LPARAM
)VK_SPACE
);
475 /* Press and release F10 or ALT */
476 if (((wParam
== VK_MENU
) && iMenuSysKey
) ||
477 ((wParam
== VK_F10
) && iF10Key
))
478 SendMessage16( WIN_GetTopParent(wndPtr
->hwndSelf
),
479 WM_SYSCOMMAND
, SC_KEYMENU
, 0L );
480 iMenuSysKey
= iF10Key
= 0;
485 if (wParam
== VK_RETURN
&& (wndPtr
->dwStyle
& WS_MINIMIZE
))
487 PostMessage16( wndPtr
->hwndSelf
, WM_SYSCOMMAND
,
488 (WPARAM16
)SC_RESTORE
, 0L );
491 if ((HIWORD(lParam
) & KEYDATA_ALT
) && wParam
)
493 if (wParam
== VK_TAB
|| wParam
== VK_ESCAPE
) break;
494 if (wParam
== VK_SPACE
&& (wndPtr
->dwStyle
& WS_CHILD
))
495 SendMessage16( wndPtr
->parent
->hwndSelf
, msg
, wParam
, lParam
);
497 SendMessage16( wndPtr
->hwndSelf
, WM_SYSCOMMAND
,
498 (WPARAM16
)SC_KEYMENU
, (LPARAM
)(DWORD
)wParam
);
500 else /* check for Ctrl-Esc */
501 if (wParam
!= VK_ESCAPE
) MessageBeep(0);
505 if (!lParam
) return 0; /* sent from ShowWindow */
506 if (!(wndPtr
->dwStyle
& WS_POPUP
) || !wndPtr
->owner
) return 0;
507 if ((wndPtr
->dwStyle
& WS_VISIBLE
) && wParam
) return 0;
508 else if (!(wndPtr
->dwStyle
& WS_VISIBLE
) && !wParam
) return 0;
509 ShowWindow( wndPtr
->hwndSelf
, wParam
? SW_SHOWNOACTIVATE
: SW_HIDE
);
513 if (wndPtr
->parent
== WIN_GetDesktop()) EndMenu();
514 if (GetCapture() == wndPtr
->hwndSelf
) ReleaseCapture();
515 WIN_ReleaseDesktop();
525 case WM_QUERYDROPOBJECT
:
526 if (wndPtr
->dwExStyle
& WS_EX_ACCEPTFILES
) return 1;
529 case WM_QUERYDRAGICON
:
534 if( (hIcon
=wndPtr
->class->hCursor
) ) return (LRESULT
)hIcon
;
535 for(len
=1; len
<64; len
++)
536 if((hIcon
=LoadIconA(wndPtr
->hInstance
,MAKEINTRESOURCEA(len
))))
537 return (LRESULT
)hIcon
;
538 return (LRESULT
)LoadIconA(0,IDI_APPLICATIONA
);
542 case WM_ISACTIVEICON
:
543 return ((wndPtr
->flags
& WIN_NCACTIVATED
) != 0);
545 case WM_NOTIFYFORMAT
:
546 if (IsWindowUnicode(wndPtr
->hwndSelf
)) return NFR_UNICODE
;
547 else return NFR_ANSI
;
550 case WM_QUERYENDSESSION
:
555 int index
= (wParam
!= ICON_SMALL
) ? GCL_HICON
: GCL_HICONSM
;
556 HICON16 hOldIcon
= GetClassLongA(wndPtr
->hwndSelf
, index
);
557 SetClassLongA(wndPtr
->hwndSelf
, index
, lParam
);
559 SetWindowPos(wndPtr
->hwndSelf
, 0, 0, 0, 0, 0, SWP_FRAMECHANGED
560 | SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOACTIVATE
563 if( wndPtr
->flags
& WIN_NATIVE
)
564 wndPtr
->pDriver
->pSetHostAttr(wndPtr
, HAK_ICONS
, 0);
571 int index
= (wParam
!= ICON_SMALL
) ? GCL_HICON
: GCL_HICONSM
;
572 return GetClassLongA(wndPtr
->hwndSelf
, index
);
576 SendMessageA( wndPtr
->parent
->hwndSelf
, msg
, wParam
, lParam
);
585 /***********************************************************************
586 * DefWindowProc16 (USER.107)
588 LRESULT WINAPI
DefWindowProc16( HWND16 hwnd
, UINT16 msg
, WPARAM16 wParam
,
591 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
594 if (!wndPtr
) return 0;
595 SPY_EnterMessage( SPY_DEFWNDPROC16
, hwnd
, msg
, wParam
, lParam
);
601 CREATESTRUCT16
*cs
= (CREATESTRUCT16
*)PTR_SEG_TO_LIN(lParam
);
603 DEFWND_SetTextA( wndPtr
, (LPCSTR
)PTR_SEG_TO_LIN(cs
->lpszName
) );
611 CONV_RECT16TO32( (RECT16
*)PTR_SEG_TO_LIN(lParam
), &rect32
);
612 result
= NC_HandleNCCalcSize( wndPtr
, &rect32
);
613 CONV_RECT32TO16( &rect32
, (RECT16
*)PTR_SEG_TO_LIN(lParam
) );
617 case WM_WINDOWPOSCHANGING
:
618 result
= WINPOS_HandleWindowPosChanging16( wndPtr
,
619 (WINDOWPOS16
*)PTR_SEG_TO_LIN(lParam
) );
622 case WM_WINDOWPOSCHANGED
:
624 WINDOWPOS16
* winPos
= (WINDOWPOS16
*)PTR_SEG_TO_LIN(lParam
);
625 DEFWND_HandleWindowPosChanged( wndPtr
, winPos
->flags
);
630 if (wParam
&& wndPtr
->text
)
632 LPSTR dest
= PTR_SEG_TO_LIN(lParam
);
633 if (!WideCharToMultiByte( CP_ACP
, 0, wndPtr
->text
, -1, dest
, wParam
, NULL
, NULL
))
635 result
= strlen(dest
);
640 DEFWND_SetTextA( wndPtr
, (LPCSTR
)PTR_SEG_TO_LIN(lParam
) );
641 if( (wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
642 NC_HandleNCPaint( hwnd
, (HRGN
)1 );
643 result
= 1; /* success. FIXME: check text length */
647 result
= DEFWND_DefWinProc( wndPtr
, msg
, wParam
, lParam
);
651 WIN_ReleaseWndPtr(wndPtr
);
652 SPY_ExitMessage( SPY_RESULT_DEFWND16
, hwnd
, msg
, result
, wParam
, lParam
);
657 /***********************************************************************
658 * DefWindowProcA [USER32.126]
661 LRESULT WINAPI
DefWindowProcA( HWND hwnd
, UINT msg
, WPARAM wParam
,
664 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
667 if (!wndPtr
) return 0;
668 SPY_EnterMessage( SPY_DEFWNDPROC
, hwnd
, msg
, wParam
, lParam
);
674 CREATESTRUCTA
*cs
= (CREATESTRUCTA
*)lParam
;
675 if (cs
->lpszName
) DEFWND_SetTextA( wndPtr
, cs
->lpszName
);
681 result
= NC_HandleNCCalcSize( wndPtr
, (RECT
*)lParam
);
684 case WM_WINDOWPOSCHANGING
:
685 result
= WINPOS_HandleWindowPosChanging( wndPtr
,
686 (WINDOWPOS
*)lParam
);
689 case WM_WINDOWPOSCHANGED
:
691 WINDOWPOS
* winPos
= (WINDOWPOS
*)lParam
;
692 DEFWND_HandleWindowPosChanged( wndPtr
, winPos
->flags
);
697 if (wParam
&& wndPtr
->text
)
699 if (!WideCharToMultiByte( CP_ACP
, 0, wndPtr
->text
, -1,
700 (LPSTR
)lParam
, wParam
, NULL
, NULL
))
701 ((LPSTR
)lParam
)[wParam
-1] = 0;
702 result
= (LRESULT
)strlen( (LPSTR
)lParam
);
707 DEFWND_SetTextA( wndPtr
, (LPCSTR
)lParam
);
708 if( (wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
709 NC_HandleNCPaint( hwnd
, (HRGN
)1 ); /* Repaint caption */
710 result
= 1; /* success. FIXME: check text length */
714 result
= DEFWND_DefWinProc( wndPtr
, msg
, wParam
, lParam
);
718 WIN_ReleaseWndPtr(wndPtr
);
719 SPY_ExitMessage( SPY_RESULT_DEFWND
, hwnd
, msg
, result
, wParam
, lParam
);
724 /***********************************************************************
725 * DefWindowProcW [USER32.127] Calls default window message handler
727 * Calls default window procedure for messages not processed
731 * Return value is dependent upon the message.
733 LRESULT WINAPI
DefWindowProcW(
734 HWND hwnd
, /* [in] window procedure recieving message */
735 UINT msg
, /* [in] message identifier */
736 WPARAM wParam
, /* [in] first message parameter */
737 LPARAM lParam
) /* [in] second message parameter */
739 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
742 if (!wndPtr
) return 0;
743 SPY_EnterMessage( SPY_DEFWNDPROC
, hwnd
, msg
, wParam
, lParam
);
749 CREATESTRUCTW
*cs
= (CREATESTRUCTW
*)lParam
;
750 if (cs
->lpszName
) DEFWND_SetTextW( wndPtr
, cs
->lpszName
);
756 if (wParam
&& wndPtr
->text
)
758 lstrcpynW( (LPWSTR
)lParam
, wndPtr
->text
, wParam
);
759 result
= strlenW( (LPWSTR
)lParam
);
764 DEFWND_SetTextW( wndPtr
, (LPCWSTR
)lParam
);
765 if( (wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
766 NC_HandleNCPaint( hwnd
, (HRGN
)1 ); /* Repaint caption */
767 result
= 1; /* success. FIXME: check text length */
771 result
= DefWindowProcA( hwnd
, msg
, wParam
, lParam
);
774 WIN_ReleaseWndPtr(wndPtr
);
775 SPY_ExitMessage( SPY_RESULT_DEFWND
, hwnd
, msg
, result
, wParam
, lParam
);