1 /*---------------------------------------------------------------------------*
2 Project: HIO2 demos - dual
3 File: MainFrame.cpp
4
5 (C)2005 HUDSON SOFT
6
7 $Header: /home/cvsroot/SDK/build/demos/hio2demo/vc++/dual/MainFrm.cpp,v 1.3 2006/03/15 06:31:26 mitu Exp $
8
9 $NoKeywords: $
10 *---------------------------------------------------------------------------*/
11
12 // MainFrm.cpp : implementation of the CMainFrame class
13 //
14
15 #include "stdafx.h"
16 #include "dual.h"
17
18 #include "MainFrm.h"
19
20 #ifdef _DEBUG
21 #define new DEBUG_NEW
22 #endif
23
24
25 // CMainFrame
26
27 IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
28
29 BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
30 ON_WM_CREATE()
31 END_MESSAGE_MAP()
32
33 static UINT indicators[] =
34 {
35 ID_SEPARATOR, // status line indicator
36 ID_INDICATOR_CAPS,
37 ID_INDICATOR_NUM,
38 ID_INDICATOR_SCRL,
39 };
40
41
42 // CMainFrame construction/destruction
43
CMainFrame()44 CMainFrame::CMainFrame()
45 {
46 // TODO: add member initialization code here
47 }
48
~CMainFrame()49 CMainFrame::~CMainFrame()
50 {
51 }
52
53
OnCreate(LPCREATESTRUCT lpCreateStruct)54 int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
55 {
56 if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
57 return -1;
58
59 if (!m_wndStatusBar.Create(this) ||
60 !m_wndStatusBar.SetIndicators(indicators,
61 sizeof(indicators)/sizeof(UINT)))
62 {
63 TRACE0("Failed to create status bar\n");
64 return -1; // fail to create
65 }
66
67 ////////// for dualApp //////////
68 #ifdef PROTOCOL_USED
69 LPCSTR lpszProtocol = "protocol used";
70 #else // PROTOCOL_USED
71 LPCSTR lpszProtocol = "non protocol";
72 #endif // PROTOCOL_USED
73 CString cAppTitle, cTitle;
74 cAppTitle.LoadString(AFX_IDS_APP_TITLE);
75 cTitle.Format("HIO2 %s ( %s )",
76 (LPCSTR)cAppTitle, lpszProtocol);
77 SetWindowText((LPCSTR)cTitle);
78
79 return 0;
80 }
81
PreCreateWindow(CREATESTRUCT & cs)82 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
83 {
84 ////////// for dualApp //////////
85 // method used to display API type in title bar
86 cs.style &= ~FWS_ADDTOTITLE;
87
88 if( !CFrameWnd::PreCreateWindow(cs) )
89 return FALSE;
90 // TODO: Modify the Window class or styles here by modifying
91 // the CREATESTRUCT cs
92
93 return TRUE;
94 }
95
96
97 // CMainFrame diagnostics
98
99 #ifdef _DEBUG
AssertValid() const100 void CMainFrame::AssertValid() const
101 {
102 CFrameWnd::AssertValid();
103 }
104
Dump(CDumpContext & dc) const105 void CMainFrame::Dump(CDumpContext& dc) const
106 {
107 CFrameWnd::Dump(dc);
108 }
109
110 #endif //_DEBUG
111
112
113 // CMainFrame message handlers
114
115