source: trunk/src/user32/setwindow.cpp@ 227

Last change on this file since 227 was 227, checked in by sandervl, 26 years ago

Fix for winhlp32 buttons

File size: 3.8 KB
Line 
1/* $Id: setwindow.cpp,v 1.3 1999-06-27 16:49:52 sandervl Exp $ */
2
3/*
4 * Win32 Get/SetWindowLong/Word user32 API functions for OS/2
5 *
6 * Copyright 1998 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 <wndproc.h>
16#include <wndclass.h>
17
18//******************************************************************************
19//******************************************************************************
20LONG WIN32API SetWindowLongA(HWND hwnd, int nIndex, LONG arg3)
21{
22 LONG rc;
23
24 dprintf(("USER32: SetWindowLongA %X %d %X\n", hwnd, nIndex, arg3));
25 if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC) {
26 Win32WindowProc *wndproc = Win32WindowProc::FindProc(hwnd);
27 if(wndproc == NULL) {//created with system class and app wants to change the handler
28 dprintf(("USER32: ERROR: SetWindowLong new WindowProc for system class\n"));
29 //SvL: 26/06/99 Should no longer be possible
30 DebugInt3();
31 return(0);
32 }
33 else {
34 if(!(nIndex == DWL_DLGPROC && wndproc->IsWindow() == TRUE)) {
35 rc = (LONG)wndproc->GetWin32Callback();
36 dprintf(("USER32: SetWindowLong change WindowProc %X to %X\n", rc, arg3));
37 wndproc->SetWin32Callback((WNDPROC)arg3);
38 O32_SetWindowLong(hwnd, nIndex, (LONG)wndproc->GetOS2Callback());
39 return(rc);
40 }
41 //else window that accesses it's normal window data
42 }
43 }
44 return O32_SetWindowLong(hwnd, nIndex, arg3);
45}
46//******************************************************************************
47//TODO: Is this always correct? (GWL_ID: window identifier??)
48//******************************************************************************
49LONG WIN32API SetWindowLongW(HWND arg1, int arg2, LONG arg3)
50{
51 dprintf(("USER32: SetWindowLongW %X %d %X\n", arg1, arg2, arg3));
52 return SetWindowLongA(arg1, arg2, arg3);
53}
54//******************************************************************************
55//******************************************************************************
56WORD WIN32API GetWindowWord( HWND arg1, int arg2)
57{
58#ifdef DEBUG
59 WriteLog("USER32: GetWindowWord\n");
60#endif
61 return O32_GetWindowWord(arg1, arg2);
62}
63//******************************************************************************
64//******************************************************************************
65WORD WIN32API SetWindowWord( HWND arg1, int arg2, WORD arg3)
66{
67 dprintf(("USER32: SetWindowWord\n"));
68 return O32_SetWindowWord(arg1, arg2, arg3);
69}
70//******************************************************************************
71//******************************************************************************
72LONG WIN32API GetWindowLongA(HWND hwnd, int nIndex)
73{
74 LONG rc;
75
76 dprintf(("USER32: GetWindowLong %X %d\n", hwnd, nIndex));
77
78 if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC) {
79 Win32WindowProc *window = Win32WindowProc::FindProc(hwnd);
80 if(window && !(nIndex == DWL_DLGPROC && window->IsWindow() == TRUE)) {
81 return (LONG)window->GetWin32Callback();
82 }
83 }
84 rc = O32_GetWindowLong(hwnd, nIndex);
85 //SvL: We must return longs here, not shorts!
86 // (fixed Winhlp32 buttons)
87 if(rc == 0xffff)
88 rc = 0xffffffff;
89 return(rc);
90}
91//******************************************************************************
92//******************************************************************************
93LONG WIN32API GetWindowLongW( HWND arg1, int arg2)
94{
95#ifdef DEBUG
96 WriteLog("USER32: GetWindowLongW\n");
97#endif
98 return GetWindowLongA(arg1, arg2); //class procedures..
99}
100//******************************************************************************
101//******************************************************************************
Note: See TracBrowser for help on using the repository browser.