1 | /* $Id: windowword.cpp,v 1.5 1999-12-09 00:53:39 sandervl 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 | }
|
---|
28 | else
|
---|
29 | {
|
---|
30 | if (nIndex == GWL_WNDPROC && !Win32BaseWindow::GetWindowFromOS2Handle(hwnd))
|
---|
31 | {
|
---|
32 | dprintf(("Start subclassing OS/2 window"));
|
---|
33 |
|
---|
34 | window = new Win32BaseWindow(hwnd,(PVOID)lNewLong);
|
---|
35 |
|
---|
36 | if(window == NULL)
|
---|
37 | {
|
---|
38 | dprintf(("Win32BaseWindow creation failed!!"));
|
---|
39 | return 0;
|
---|
40 | }
|
---|
41 |
|
---|
42 | if(GetLastError() != 0)
|
---|
43 | {
|
---|
44 | dprintf(("Win32BaseWindow error found!!"));
|
---|
45 | delete window;
|
---|
46 | return 0;
|
---|
47 | }
|
---|
48 |
|
---|
49 | return (LONG)window->getOldWndProc();
|
---|
50 | }
|
---|
51 | else dprintf(("SetWindowLongA; window %x not found!", hwnd));
|
---|
52 | }
|
---|
53 | return 0;
|
---|
54 | }
|
---|
55 | //******************************************************************************
|
---|
56 | //******************************************************************************
|
---|
57 | LONG WIN32API SetWindowLongW(HWND hwnd, int nIndex, LONG lNewLong)
|
---|
58 | {
|
---|
59 | Win32BaseWindow *window;
|
---|
60 |
|
---|
61 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
62 | if(window)
|
---|
63 | {
|
---|
64 | return window->SetWindowLongA(nIndex,lNewLong, TRUE);
|
---|
65 | }
|
---|
66 | else
|
---|
67 | {
|
---|
68 | if (nIndex == GWL_WNDPROC && !Win32BaseWindow::GetWindowFromOS2Handle(hwnd))
|
---|
69 | {
|
---|
70 | dprintf(("Start subclassing OS/2 window"));
|
---|
71 |
|
---|
72 | window = new Win32BaseWindow(hwnd,(PVOID)lNewLong);
|
---|
73 |
|
---|
74 | if(window == NULL)
|
---|
75 | {
|
---|
76 | dprintf(("Win32BaseWindow creation failed!!"));
|
---|
77 | return 0;
|
---|
78 | }
|
---|
79 |
|
---|
80 | if(GetLastError() != 0)
|
---|
81 | {
|
---|
82 | dprintf(("Win32BaseWindow error found!!"));
|
---|
83 | delete window;
|
---|
84 | return 0;
|
---|
85 | }
|
---|
86 |
|
---|
87 | return (LONG)window->getOldWndProc();
|
---|
88 | }
|
---|
89 | else dprintf(("SetWindowLongW; window %x not found!", hwnd));
|
---|
90 | }
|
---|
91 | return 0;
|
---|
92 | }
|
---|
93 | //******************************************************************************
|
---|
94 | //******************************************************************************
|
---|
95 | WORD WIN32API GetWindowWord(HWND hwnd, int nIndex)
|
---|
96 | {
|
---|
97 | Win32BaseWindow *window;
|
---|
98 |
|
---|
99 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
100 | if(window)
|
---|
101 | {
|
---|
102 | return window->GetWindowWord(nIndex);
|
---|
103 | }
|
---|
104 | else
|
---|
105 | {
|
---|
106 | dprintf(("GetWindowWord; window %x not found!", hwnd));
|
---|
107 | }
|
---|
108 | return 0;
|
---|
109 | }
|
---|
110 | //******************************************************************************
|
---|
111 | //******************************************************************************
|
---|
112 | WORD WIN32API SetWindowWord(HWND hwnd, int nIndex, WORD arg3)
|
---|
113 | {
|
---|
114 | Win32BaseWindow *window;
|
---|
115 |
|
---|
116 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
117 | if(window)
|
---|
118 | {
|
---|
119 | return window->SetWindowWord(nIndex, arg3);
|
---|
120 | }
|
---|
121 | else
|
---|
122 | {
|
---|
123 | dprintf(("SetWindowWord; window %x not found!", hwnd));
|
---|
124 | }
|
---|
125 | return 0;
|
---|
126 | }
|
---|
127 | //******************************************************************************
|
---|
128 | //******************************************************************************
|
---|
129 | LONG WIN32API GetWindowLongA(HWND hwnd, int nIndex)
|
---|
130 | {
|
---|
131 | Win32BaseWindow *window;
|
---|
132 |
|
---|
133 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
134 | if(window)
|
---|
135 | {
|
---|
136 | return window->GetWindowLongA(nIndex);
|
---|
137 | }
|
---|
138 | else
|
---|
139 | {
|
---|
140 | dprintf(("GetWindowLongA; window %x (%d) not found!", hwnd, nIndex));
|
---|
141 | }
|
---|
142 | return 0;
|
---|
143 | }
|
---|
144 | //******************************************************************************
|
---|
145 | //******************************************************************************
|
---|
146 | LONG WIN32API GetWindowLongW(HWND hwnd, int nIndex)
|
---|
147 | {
|
---|
148 | Win32BaseWindow *window;
|
---|
149 |
|
---|
150 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
151 | if(window)
|
---|
152 | {
|
---|
153 | return window->GetWindowLongA(nIndex, TRUE);
|
---|
154 | }
|
---|
155 | else
|
---|
156 | {
|
---|
157 | dprintf(("GetWindowLongW; window %x not found!", hwnd));
|
---|
158 | }
|
---|
159 | return 0;
|
---|
160 | }
|
---|
161 | //******************************************************************************
|
---|
162 | //******************************************************************************
|
---|