home *** CD-ROM | disk | FTP | other *** search
- // ObjectWindows - (C) Copyright 1992 by Borland International
-
- // Modifications to demonstrate the SPELMATE DLL spell checker
- // (c) 1993, Stewart McSporran for Aciran Software Systems
-
- #include <owl.h>
- #include <string.h>
- #include <filewnd.h>
- #include "spelltst.h"
- #pragma hdrstop
- #include "spell.h"
-
- // Declare TFileApp, a TApplication descendant
- class TFileApp : public TApplication {
- public:
- TFileApp(LPSTR AName, HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow)
- : TApplication(AName, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
- virtual void InitMainWindow();
- virtual void InitInstance();
- };
-
- // Declare TMyFileWindow, a TFileWindow descendant
- class TMyFileWindow : public TFileWindow {
- public:
- TMyFileWindow(PTWindowsObject, LPSTR, LPSTR);
- virtual void GetWindowClass(WNDCLASS &wc);
- virtual void CMSpell(RTMessage Msg) = [CM_FIRST + CM_TOOLSSPELL];
- virtual void CMAbout(RTMessage Msg) = [CM_FIRST + CM_ABOUT];
- };
-
- // Construct a TMyFileWindow, loading its menu
- TMyFileWindow::TMyFileWindow(PTWindowsObject AParent, LPSTR ATitle,
- LPSTR AFileName)
- : TFileWindow(AParent, ATitle, AFileName)
- {
- AssignMenu("FileCommands");
- }
-
- void TMyFileWindow::GetWindowClass(WNDCLASS &wc)
- {
- TWindow::GetWindowClass(wc);
- wc.hIcon = LoadIcon(wc.hInstance,MAKEINTRESOURCE(100));
- }
-
- // Construct the TFileApp's MainWindow of type TMyFileWindow
- void TFileApp::InitMainWindow()
- {
- MainWindow = new TMyFileWindow(NULL, "File Window", "");
- }
-
- /* Initialize each MS-Windows application instance, loading an
- accelerator table */
- void TFileApp::InitInstance()
- {
- TApplication::InitInstance();
- if ( Status == 0 )
- HAccTable = LoadAccelerators(hInstance, "FileCommands");
- }
-
-
- #pragma argsused
- void TMyFileWindow::CMSpell(RTMessage Msg)
- {
- // spellcheck the edit control used by TFileWindow
- Spell(Editor);
- }
-
- #pragma argsused
- void TMyFileWindow::CMAbout(RTMessage Msg)
- {
- TDialog *pAbout;
- pAbout = new TDialog(this,DLG_ABOUT);
- GetModule()->ExecDialog(pAbout);
- }
-
- // Run the FileApp
- int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow)
- {
- TFileApp FileApp ("FileApp", hInstance, hPrevInstance,
- lpCmdLine, nCmdShow);
- FileApp.Run();
- return FileApp.Status;
- }
-
-