shdocvw: Move IConnectionPointContainer implementation to separated object.
[wine/testsucceed.git] / dlls / user / winproc.h
blobe961d10f0f2fda8de287292a6012be9cd1c452b5
1 /*
2 * Window procedure callbacks definitions
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_WINPROC_H
22 #define __WINE_WINPROC_H
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wine/winbase16.h"
29 #include "winnls.h"
31 typedef struct
33 WPARAM16 wParam;
34 LPARAM lParam;
35 LRESULT lResult;
36 } MSGPARAM16;
38 typedef struct
40 WPARAM wParam;
41 LPARAM lParam;
42 LRESULT lResult;
43 } MSGPARAM;
45 struct tagWINDOWPROC;
47 extern WNDPROC16 WINPROC_GetProc16( WNDPROC proc, BOOL unicode );
48 extern WNDPROC WINPROC_AllocProc16( WNDPROC16 func );
49 extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode );
50 extern WNDPROC WINPROC_AllocProc( WNDPROC funcA, WNDPROC funcW );
51 extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val );
53 extern INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam,
54 LPARAM *plparam );
55 extern INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
56 UINT *pmsg32, WPARAM *pwparam32,
57 LPARAM *plparam );
58 extern INT WINPROC_MapMsg16To32W( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
59 UINT *pmsg32, WPARAM *pwparam32,
60 LPARAM *plparam );
61 extern INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32,
62 WPARAM wParam32, UINT16 *pmsg16,
63 WPARAM16 *pwparam16, LPARAM *plparam );
64 extern INT WINPROC_MapMsg32WTo16( HWND hwnd, UINT msg32,
65 WPARAM wParam32, UINT16 *pmsg16,
66 WPARAM16 *pwparam16, LPARAM *plparam );
67 extern LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam,
68 LPARAM lParam, LRESULT result,
69 WNDPROC dispatch );
70 extern LRESULT WINPROC_UnmapMsg16To32A( HWND hwnd, UINT msg, WPARAM wParam,
71 LPARAM lParam, LRESULT result );
72 extern LRESULT WINPROC_UnmapMsg16To32W( HWND hwnd, UINT msg, WPARAM wParam,
73 LPARAM lParam, LRESULT result,
74 WNDPROC dispatch );
75 extern void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam,
76 LPARAM lParam, MSGPARAM16* pm16 );
77 extern void WINPROC_UnmapMsg32WTo16( HWND hwnd, UINT msg, WPARAM wParam,
78 LPARAM lParam, MSGPARAM16* pm16 );
80 extern INT_PTR WINPROC_CallDlgProc16( DLGPROC16 func, HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam );
81 extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
82 extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
84 /* map a Unicode string to a 16-bit pointer */
85 inline static SEGPTR map_str_32W_to_16( LPCWSTR str )
87 LPSTR ret;
88 INT len;
90 if (!HIWORD(str)) return (SEGPTR)LOWORD(str);
91 len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
92 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
93 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
94 return MapLS(ret);
97 /* unmap a Unicode string that was converted to a 16-bit pointer */
98 inline static void unmap_str_32W_to_16( SEGPTR str )
100 if (!HIWORD(str)) return;
101 HeapFree( GetProcessHeap(), 0, MapSL(str) );
102 UnMapLS( str );
105 /* map a 16-bit pointer to a Unicode string */
106 inline static LPWSTR map_str_16_to_32W( SEGPTR str )
108 LPWSTR ret;
109 INT len;
111 if (!HIWORD(str)) return (LPWSTR)(ULONG_PTR)LOWORD(str);
112 len = MultiByteToWideChar( CP_ACP, 0, MapSL(str), -1, NULL, 0 );
113 if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
114 MultiByteToWideChar( CP_ACP, 0, MapSL(str), -1, ret, len );
115 return ret;
118 /* unmap a 16-bit pointer that was converted to a Unicode string */
119 inline static void unmap_str_16_to_32W( LPCWSTR str )
121 if (HIWORD(str)) HeapFree( GetProcessHeap(), 0, (void *)str );
125 /* Class functions */
126 struct tagCLASS; /* opaque structure */
127 struct tagWND;
128 extern void CLASS_RegisterBuiltinClasses(void);
129 extern void CLASS_AddWindow( struct tagCLASS *class, struct tagWND *win, BOOL unicode );
130 extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
132 #endif /* __WINE_WINPROC_H */