home *** CD-ROM | disk | FTP | other *** search
- Here I am again...
- A couple of months ago I put together some base classes for windows
- development and uploaded them on to Compuserve. I didn't at the time
- relize how popular they would be.
-
- With these files I would like to address the biggest complaint I've
- had about the windows classes, namely the inability to call
- class member functions of the standard window from inside WndProc.
-
- What's included:
- Test.h // Defines the dialog class for this app.
- Testm.h // Defines menu selections
- Test.cpp // Main program
- Test.res // The menu, icon, and dialog
- Test.def // Keeps the linker happy
-
- Winbase.h // Base window class and base registration class
- SWin.h // A standard window class that includes Registration
- and display
- Dlgbase.h // Base dialog class
- readme2 // This piece of great literature
-
- To build the new demo type:
-
- C:\BORLANC\BIN> bccx -WS -v test
- C:\BORLANDC\BIN> rc test.res test.exe
-
- So how does this work and what changed from the last version?
- WINBASE.H includes two classes, WindowRegClass and Windows these are
- used to build derived classes like StdWindow in SWIN.H they can also be used
- to build a non "standard window". To build a non-standard window use the
- base classes to define a window or derive a class from them that defines
- your window.
- To build a standard type window as I've defined it, use the StdWindow
- class defined in SWIN.H (menu's, icon's, and cursor's are optional).
- Send it:
- 1. The window title
- 2. The program instance from the winmain parameter
- 3. The previous instance of the program also from winmain parameters
- 4. Menu name // optional
- 5. Icon name // optional
- 6. Cursor name // optional
-
- Define a procedure called WndProc:
- long FAR PASCAL _export StdWindow::WndProc(HWND hwnd,WORD message,
- WORD wParam,LONG lParam)
-
- That's it.....and they said windows programming was hard!...
-
- The dialog class, however, is different. You MUST build a derived
- class from it and define the dialogs procedure as a member function
- (See Test.h for an example).
-
- Now, the changes from last version. The main change is the
- standard window class. In the previous version registration and
- display were done manually. Why? I don't know... So, I brought
- the whole main window process together in one class and made the
- window procedure ( WndProc ) a member of the class. The reduced
- size of the class calls makes it easier to use BUT makes it very
- hard to customize the main window. The addition of WndProc to the
- StdWindow class now allows you to access the member functions of
- StdWindow ( These you will have to write yourself.....).
-
- As before feel free to distribute this freely.
- If you do add some good member functions or anything else
- how about sending me a copy?...
- Thanks for all the positive comments I've received on the
- classes and I hope these new ones help.
-
- I can be reached on CompuServe, but I don't know how.
- Davin S. Hills
- 3800 Harding Rd. #28
- Des Moines, Iowa 50310
-