home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!weinstoc
- From: weinstoc@sei.cmu.edu (Chuck Weinstock)
- Subject: OWL Help?
- Message-ID: <1992Nov17.145826.4758@sei.cmu.edu>
- Sender: netnews@sei.cmu.edu (Netnews)
- Organization: The Software Engineering Institute
- Date: Tue, 17 Nov 1992 14:58:26 GMT
- Lines: 139
-
-
- The OWL program below works just fine when I ask it to display the dialog box,
- but an error window pops up upon exit from the dialog saying that an error
- message -1 was received and asking whether it should continue. I've tried
- everything I could think of to fix this problem and I'm fresh out of ideas.
- Can anyone out there help me?
-
- Chuck Weinstock
-
- #include <edit.h>
- #include <owl.h>
-
- #define D_ONE_ITEM 3101
- #define FM_EXIT 2101
- #define DM_ONE 2102
-
- struct {
- char DataOne[6];
- } DialogOneData;
-
- class TDialogOne : public TDialog {
-
- TEdit* Data;
-
- public:
-
- TDialogOne(PTWindowsObject);
- };
-
- TDialogOne::TDialogOne(PTWindowsObject AParent) :
- TDialog(AParent,"DIALOG_1")
- {
- Data = new TEdit(this,DM_ONE,6);
- TransferBuffer = (LPSTR) &DialogOneData;
- };
-
- class TTestOwl : public TWindow {
-
- public:
-
- TTestOwl(PTWindowsObject AParent,LPSTR Title) :
- TWindow(AParent,Title) {}
- LPSTR GetClassName() {return "TestOwl";}
- void GetWindowClass(WNDCLASS&);
- virtual void HandleDialogOne(RTMessage) = [CM_FIRST + DM_ONE];
- virtual void Exit(RTMessage) = [CM_FIRST + FM_EXIT] {
- CloseWindow();
- }
- };
-
- void TTestOwl::GetWindowClass(WNDCLASS& wndClass)
- {
- TWindow::GetWindowClass(wndClass);
-
- // attach a menu to the main window
- wndClass.lpszMenuName = "TestMenu";
- }
-
- void TTestOwl::HandleDialogOne(RTMessage)
- {
- int Result;
-
- Result = GetApplication()->ExecDialog(new TDialogOne(this));
- }
-
- class TUserApplication: public TApplication {
-
- public:
-
- TUserApplication(LPSTR AName,
- HINSTANCE AnInstance,
- HINSTANCE APrevInstance,
- LPSTR ACmdLine,
- int ACmdShow)
-
- : TApplication(AName, AnInstance,
- APrevInstance,
- ACmdLine, ACmdShow) {}
- virtual void InitMainWindow();
- };
-
- LPSTR APPLICATION_NAME =
- "Test Owl";
-
- void TUserApplication::InitMainWindow()
- {
- MainWindow = new TTestOwl(NULL,
- APPLICATION_NAME);
- }
-
- int PASCAL WinMain(HINSTANCE AnInstance, HINSTANCE APrevInstance,
- LPSTR ACmdLine, int ACmdShow)
- {
- TUserApplication Application(APPLICATION_NAME,
- AnInstance,
- APrevInstance,
- ACmdLine,
- ACmdShow);
- Application.nCmdShow = SW_SHOWMAXIMIZED;
- Application.Run();
- return Application.Status;
- }
-
- In case it's useful, here is the .RC file.
-
- #define D_ONE_ITEM 3101
- #define FM_EXIT 2101
- #define DM_ONE 2102
-
- TestMenu MENU
- BEGIN
- POPUP "&File"
- BEGIN
- MENUITEM "&Exit", FM_EXIT
- END
-
- POPUP "&Dialogs"
- BEGIN
- MENUITEM "Dialog&1", DM_ONE
- END
-
- END
-
-
- DIALOG_1 DIALOG 18, 18, 142, 92
- STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
- CLASS "BorDlg"
- CAPTION "DIALOG_1"
- BEGIN
- CONTROL "Button", IDOK, "BorBtn", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 100, 62, 32, 20
- EDITTEXT D_ONE_ITEM, 48, 24, 53, 12, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP
- RTEXT "Data", -1, 13, 26, 30, 8, SS_RIGHT | WS_CHILD | WS_VISIBLE | WS_GROUP
- END
-
-
- Chuck Weinstock weinstock@sei.cmu.edu
- Software Engineering Institute (412) 268-7719
- Carnegie Mellon University (412) 268-5758 (Fax)
- Pittsburgh, PA 15213
-