Subversion Repositories filter_foundry

Rev

Rev 454 | Rev 461 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 454 Rev 460
Line 95... Line 95...
95
        else {
95
        else {
96
                return 0;
96
                return 0;
97
        }
97
        }
98
}
98
}
99
 
99
 
-
 
100
LRESULT CALLBACK DummyWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
-
 
101
        return DefWindowProc(hwnd, uMsg, wParam, lParam);
-
 
102
}
-
 
103
 
100
Boolean MakeSimpleSubclass(LPCTSTR targetClass, LPCTSTR sourceClass) {
104
Boolean MakeSimpleSubclass(LPCTSTR targetClass, LPCTSTR sourceClass) {
101
        WNDCLASS clx;
105
        WNDCLASS clx;
102
 
106
 
103
        if (GetClassInfo(hDllInstance, sourceClass, &clx) != 0) {
107
        if (GetClassInfo(hDllInstance, sourceClass, &clx) != 0) {
104
                clx.lpszClassName = targetClass;
108
                clx.lpszClassName = targetClass;
Line 112... Line 116...
112
                else {
116
                else {
113
                        return true;
117
                        return true;
114
                }
118
                }
115
        }
119
        }
116
        else {
120
        else {
-
 
121
                if ((xstrcmp(sourceClass, WC_BUTTON) == 0) || (xstrcmp(sourceClass, WC_STATIC) == 0)) {
-
 
122
                        // GetClassInfo(WC_STATIC) and GetClassInfo(WC_BUTTON) fail on Win32s (Windows 3.11)
-
 
123
                        // So we create a fake-class now. It will be replaced with the real Button/Static WndProc later!
-
 
124
                        clx.style = 0;
-
 
125
                        clx.lpfnWndProc = DummyWndProc;
-
 
126
                        clx.cbClsExtra = 0;
-
 
127
                        clx.cbWndExtra = 0;
-
 
128
                        clx.hInstance = hDllInstance;
-
 
129
                        clx.hIcon = 0;
-
 
130
                        clx.hCursor = 0;
-
 
131
                        clx.hbrBackground = 0;
-
 
132
                        clx.lpszMenuName = 0;
-
 
133
                        clx.lpszClassName = targetClass;
-
 
134
 
-
 
135
                        if (RegisterClass(&clx) == 0) {
-
 
136
                                TCHAR s[0x300];
-
 
137
                                xstrcpy(s, (TCHAR*)TEXT("RegisterClass failed: "));
-
 
138
                                FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, s + xstrlen(s), 0x300 - (DWORD)xstrlen(s), NULL);
-
 
139
                                dbg(&s[0]);
-
 
140
                                return false;
-
 
141
                        }
-
 
142
                        else {
-
 
143
                                return true;
-
 
144
                        }
-
 
145
                }
-
 
146
                else {
-
 
147
                        simplealert(TEXT("GetClassInfo failed"));
-
 
148
                }
117
                return false;
149
                return false;
118
        }
150
        }
119
}
151
}
120
 
152
 
121
void Slider_Uninit_PluginDll() {
153
void Slider_Uninit_PluginDll() {
Line 198... Line 230...
198
        return MakeSimpleSubclass(targetClass, TEXT("msctls_trackbar32"));
230
        return MakeSimpleSubclass(targetClass, TEXT("msctls_trackbar32"));
199
}
231
}
200
 
232
 
201
Boolean Slider_Init_None(LPCTSTR targetClass) {
233
Boolean Slider_Init_None(LPCTSTR targetClass) {
202
        // Make "FoundrySlider" a subclass of "STATIC" (making it invisible)
234
        // Make "FoundrySlider" a subclass of "STATIC" (making it invisible)
203
        return MakeSimpleSubclass(targetClass, TEXT("STATIC"));
235
        return MakeSimpleSubclass(targetClass, WC_STATIC);
204
}
236
}