|
|
1.1 root 1: Sample: SUBCLASS Program Demonstration
2:
3: Summary:
4:
5: The SUBCLASS sample demonstrates how a program can subclass
6: standard controls in order to extend their normal
7: functionality. This sample replaces the window procedure for
8: buttons, edit fields, and list boxes.
9:
10: More Information:
11:
12: The standard subclassing technique is to replace the window
13: procedure in the window structure by using:
14:
15: SetWindowLong (hwnd, GWL_WNDPROC, (LONG)
16: SubclassWndProc);
17:
18: In the SUBCLASS sample, the old window procedure is also
19: saved in a structure pointed at by the user data. Thus, any
20: functionality can be added to various classes of windows
21: without having to know what the class originally was.
22:
23: In this sample, the subclass procedure adds the ability to
24: move and size the control windows when the application is
25: not in "test mode." When the application is in test mode,
26: the subclass procedure calls the original window procedure
27: and the controls behave as normal. Thus, this sample
28: provides the bare bones for a "dialog editor" type of
29: program.
30:
31: The following is a list of the Win32 API functions used in
32: this sample:
33:
34: CallWindowPro GetMessage LocalUnlock SetCursorPos
35: c
36: CheckMenuItem GetStockObjec PostQuitMessa SetROP2
37: t ge
38: ClientToScree GetWindowLong Rectangle SetWindowLong
39: n
40: CreateWindow GetWindowRect ReleaseCaptur SetWindowPos
41: e
42: DispatchMessa InvalidateRec ReleaseDC ShowWindow
43: ge t
44: GetCapture LoadCursor ScreenToClien TranslateMess
45: t age
46: GetClientRect LoadIcon SelectObject
47: GetDC LocalAlloc SetCapture
48: GetMenu LocalHandle SetCursor
49:
50:
51:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.