1 | /* $Id: windowword.cpp,v 1.2 1999-10-17 12:17:46 cbratschi Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 Get/SetWindowLong/Word user32 API functions for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1998-1999 Sander van Leeuwen
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
10 | *
|
---|
11 | */
|
---|
12 | #include <os2win.h>
|
---|
13 | #include <misc.h>
|
---|
14 |
|
---|
15 | #include <win32wbase.h>
|
---|
16 |
|
---|
17 | //******************************************************************************
|
---|
18 | //******************************************************************************
|
---|
19 | LONG WIN32API SetWindowLongA(HWND hwnd, int nIndex, LONG lNewLong)
|
---|
20 | {
|
---|
21 | Win32BaseWindow *window;
|
---|
22 |
|
---|
23 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
24 | if(window)
|
---|
25 | {
|
---|
26 | return window->SetWindowLongA(nIndex,lNewLong);
|
---|
27 | } else
|
---|
28 | {
|
---|
29 | if (nIndex == GWL_WNDPROC && !Win32BaseWindow::GetWindowFromOS2Handle(hwnd))
|
---|
30 | {
|
---|
31 | dprintf(("Start subclassing OS/2 window"));
|
---|
32 |
|
---|
33 | window = new Win32BaseWindow(hwnd,(PVOID)lNewLong);
|
---|
34 |
|
---|
35 | if(window == NULL)
|
---|
36 | {
|
---|
37 | dprintf(("Win32BaseWindow creation failed!!"));
|
---|
38 | return 0;
|
---|
39 | }
|
---|
40 |
|
---|
41 | if(GetLastError() != 0)
|
---|
42 | {
|
---|
43 | dprintf(("Win32BaseWindow error found!!"));
|
---|
44 | delete window;
|
---|
45 | return 0;
|
---|
46 | }
|
---|
47 |
|
---|
48 | return (LONG)window->getOldWndProc();
|
---|
49 | } else dprintf(("SetWindowLongA; window %x not found!", hwnd));
|
---|
50 | }
|
---|
51 | return 0;
|
---|
52 | }
|
---|
53 | //******************************************************************************
|
---|
54 | //******************************************************************************
|
---|
55 | LONG WIN32API SetWindowLongW(HWND hwnd, int nIndex, LONG lNewLong)
|
---|
56 | {
|
---|
57 | Win32BaseWindow *window;
|
---|
58 |
|
---|
59 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
60 | if(window)
|
---|
61 | {
|
---|
62 | return window->SetWindowLongA(nIndex,lNewLong);
|
---|
63 | } else
|
---|
64 | {
|
---|
65 | if (nIndex == GWL_WNDPROC && !Win32BaseWindow::GetWindowFromOS2Handle(hwnd))
|
---|
66 | {
|
---|
67 | dprintf(("Start subclassing OS/2 window"));
|
---|
68 |
|
---|
69 | window = new Win32BaseWindow(hwnd,(PVOID)lNewLong);
|
---|
70 |
|
---|
71 | if(window == NULL)
|
---|
72 | {
|
---|
73 | dprintf(("Win32BaseWindow creation failed!!"));
|
---|
74 | return 0;
|
---|
75 | }
|
---|
76 |
|
---|
77 | if(GetLastError() != 0)
|
---|
78 | {
|
---|
79 | dprintf(("Win32BaseWindow error found!!"));
|
---|
80 | delete window;
|
---|
81 | return 0;
|
---|
82 | }
|
---|
83 |
|
---|
84 | return (LONG)window->getOldWndProc();
|
---|
85 | } else dprintf(("SetWindowLongW; window %x not found!", hwnd));
|
---|
86 | }
|
---|
87 | return 0;
|
---|
88 | }
|
---|
89 | //******************************************************************************
|
---|
90 | //******************************************************************************
|
---|
91 | WORD WIN32API GetWindowWord(HWND hwnd, int nIndex)
|
---|
92 | {
|
---|
93 | Win32BaseWindow *window;
|
---|
94 |
|
---|
95 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
96 | if(window)
|
---|
97 | {
|
---|
98 | return window->GetWindowWord(nIndex);
|
---|
99 | }
|
---|
100 | else
|
---|
101 | {
|
---|
102 | dprintf(("GetWindowWord; window %x not found!", hwnd));
|
---|
103 | }
|
---|
104 | return 0;
|
---|
105 | }
|
---|
106 | //******************************************************************************
|
---|
107 | //******************************************************************************
|
---|
108 | WORD WIN32API SetWindowWord(HWND hwnd, int nIndex, WORD arg3)
|
---|
109 | {
|
---|
110 | Win32BaseWindow *window;
|
---|
111 |
|
---|
112 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
113 | if(window)
|
---|
114 | {
|
---|
115 | return window->SetWindowWord(nIndex, arg3);
|
---|
116 | }
|
---|
117 | else
|
---|
118 | {
|
---|
119 | dprintf(("SetWindowWord; window %x not found!", hwnd));
|
---|
120 | }
|
---|
121 | return 0;
|
---|
122 | }
|
---|
123 | //******************************************************************************
|
---|
124 | //******************************************************************************
|
---|
125 | LONG WIN32API GetWindowLongA(HWND hwnd, int nIndex)
|
---|
126 | {
|
---|
127 | Win32BaseWindow *window;
|
---|
128 |
|
---|
129 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
130 | if(window)
|
---|
131 | {
|
---|
132 | return window->GetWindowLongA(nIndex);
|
---|
133 | }
|
---|
134 | else
|
---|
135 | {
|
---|
136 | dprintf(("GetWindowLongA; window %x not found!", hwnd));
|
---|
137 | }
|
---|
138 | return 0;
|
---|
139 | }
|
---|
140 | //******************************************************************************
|
---|
141 | //******************************************************************************
|
---|
142 | LONG WIN32API GetWindowLongW(HWND hwnd, int nIndex)
|
---|
143 | {
|
---|
144 | Win32BaseWindow *window;
|
---|
145 |
|
---|
146 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
147 | if(window)
|
---|
148 | {
|
---|
149 | return window->GetWindowLongA(nIndex);
|
---|
150 | }
|
---|
151 | else
|
---|
152 | {
|
---|
153 | dprintf(("GetWindowLongW; window %x not found!", hwnd));
|
---|
154 | }
|
---|
155 | return 0;
|
---|
156 | }
|
---|
157 | //******************************************************************************
|
---|
158 | //******************************************************************************
|
---|