Replaced the --mode winebuild option by a --subsystem option for
[wine/hacks.git] / dlls / user / winproc.h
blobe5507711ab66cc2635acdd8ebfb1b36ff1b2673b
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 enum
33 WIN_PROC_INVALID,
34 WIN_PROC_16,
35 WIN_PROC_32A,
36 WIN_PROC_32W
37 } WINDOWPROCTYPE;
39 typedef enum
41 WIN_PROC_CLASS,
42 WIN_PROC_WINDOW,
43 WIN_PROC_TIMER
44 } WINDOWPROCUSER;
46 typedef struct
48 WPARAM16 wParam;
49 LPARAM lParam;
50 LRESULT lResult;
51 } MSGPARAM16;
53 typedef struct
55 WPARAM wParam;
56 LPARAM lParam;
57 LRESULT lResult;
58 } MSGPARAM;
60 struct tagWINDOWPROC;
62 extern WNDPROC16 WINPROC_GetProc( WNDPROC proc, WINDOWPROCTYPE type );
63 extern BOOL WINPROC_SetProc( WNDPROC *pFirst, WNDPROC func,
64 WINDOWPROCTYPE type, WINDOWPROCUSER user );
65 extern void WINPROC_FreeProc( WNDPROC proc, WINDOWPROCUSER user );
66 extern WINDOWPROCTYPE WINPROC_GetProcType( WNDPROC proc );
68 extern INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam,
69 LPARAM *plparam );
70 extern INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
71 UINT *pmsg32, WPARAM *pwparam32,
72 LPARAM *plparam );
73 extern INT WINPROC_MapMsg16To32W( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
74 UINT *pmsg32, WPARAM *pwparam32,
75 LPARAM *plparam );
76 extern INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32,
77 WPARAM wParam32, UINT16 *pmsg16,
78 WPARAM16 *pwparam16, LPARAM *plparam );
79 extern INT WINPROC_MapMsg32WTo16( HWND hwnd, UINT msg32,
80 WPARAM wParam32, UINT16 *pmsg16,
81 WPARAM16 *pwparam16, LPARAM *plparam );
82 extern LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam,
83 LPARAM lParam, LRESULT result );
84 extern LRESULT WINPROC_UnmapMsg16To32A( HWND hwnd, UINT msg, WPARAM wParam,
85 LPARAM lParam, LRESULT result );
86 extern LRESULT WINPROC_UnmapMsg16To32W( HWND hwnd, UINT msg, WPARAM wParam,
87 LPARAM lParam, LRESULT result );
88 extern void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam,
89 LPARAM lParam, MSGPARAM16* pm16 );
90 extern void WINPROC_UnmapMsg32WTo16( HWND hwnd, UINT msg, WPARAM wParam,
91 LPARAM lParam, MSGPARAM16* pm16 );
93 /* map a Unicode string to a 16-bit pointer */
94 inline static SEGPTR map_str_32W_to_16( LPCWSTR str )
96 LPSTR ret;
97 INT len;
99 if (!HIWORD(str)) return (SEGPTR)LOWORD(str);
100 len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
101 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
102 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
103 return MapLS(ret);
106 /* unmap a Unicode string that was converted to a 16-bit pointer */
107 inline static void unmap_str_32W_to_16( SEGPTR str )
109 if (!HIWORD(str)) return;
110 HeapFree( GetProcessHeap(), 0, MapSL(str) );
111 UnMapLS( str );
114 /* map a 16-bit pointer to a Unicode string */
115 inline static LPWSTR map_str_16_to_32W( SEGPTR str )
117 LPWSTR ret;
118 INT len;
120 if (!HIWORD(str)) return (LPWSTR)(ULONG_PTR)LOWORD(str);
121 len = MultiByteToWideChar( CP_ACP, 0, MapSL(str), -1, NULL, 0 );
122 if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
123 MultiByteToWideChar( CP_ACP, 0, MapSL(str), -1, ret, len );
124 return ret;
127 /* unmap a 16-bit pointer that was converted to a Unicode string */
128 inline static void unmap_str_16_to_32W( LPCWSTR str )
130 if (HIWORD(str)) HeapFree( GetProcessHeap(), 0, (void *)str );
134 /* Class functions */
135 struct tagCLASS; /* opaque structure */
136 struct tagWND;
137 extern void CLASS_RegisterBuiltinClasses(void);
138 extern void CLASS_AddWindow( struct tagCLASS *class, struct tagWND *win, WINDOWPROCTYPE type );
139 extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
141 /* Timer functions */
142 extern void TIMER_RemoveWindowTimers( HWND hwnd );
143 extern void TIMER_RemoveThreadTimers(void);
144 extern BOOL TIMER_IsTimerValid( HWND hwnd, UINT id, WNDPROC proc );
146 #endif /* __WINE_WINPROC_H */