1 //*******************************************************************************
4 // You may use this source code, compile or redistribute it as part of your application
5 // for free. You cannot redistribute it as a part of a software development
6 // library without the agreement of the author. If the sources are
7 // distributed along with the application, you should leave the original
8 // copyright notes in the source code without any changes.
9 // This code can be used WITHOUT ANY WARRANTIES at your own risk.
11 // For the latest updates to this code, check this site:
12 // http://www.masmex.com
15 // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
16 //*******************************************************************************
22 #error include 'stdafx.h' before including this file for PCH
25 class CTRL_EXT_CLASS CUIApp : public CWinApp
27 DECLARE_DYNAMIC(CUIApp)
31 void SetStatusBarText(UINT nPaneID,LPCTSTR Text,UINT nIconID=0);
32 void SetStatusBarText(UINT nPaneID,LPCTSTR Text,CView *pView,UINT nIconID=0);
33 void SetStatusBarText(UINT nPaneID,UINT nResID,UINT nIconID=0);
34 void SetStatusBarText(LPCTSTR Text);
35 void SetStatusBarIcon(UINT nPaneID,UINT nIconID,bool bAdd);
36 void SetStatusBarIdleMessage();
37 CString GetRegAppKey();
39 static bool COMMessage(HRESULT hr,UINT nID);
40 static void ErrorMessage(UINT nID,DWORD dwError=0);
41 static bool COMMessage(HRESULT hr,LPCTSTR pszMess=NULL);
42 static void ErrorMessage(LPCTSTR pszMess=NULL,DWORD dwError=0);
44 // ClassWizard generated virtual function overrides
45 //{{AFX_VIRTUAL(CUIApp)
47 virtual BOOL InitInstance();
48 virtual int ExitInstance();
50 // CMultiDocTemplate* m_pWebSitesDocTemplate;
51 void ChangeProfile(LPCTSTR szRegistryKey,LPCTSTR szProfileName);
52 void RestoreProfile();
54 CFrameWnd *GetMainFrame(CWnd *pWnd);
55 CView *GetView(CRuntimeClass *pClass);
56 CDocTemplate *GetFirstDocTemplate();
57 CDocument *GetDocument();
59 bool RegisterMyClass();
62 // NOTE - the ClassWizard will add and remove member functions here.
63 // DO NOT EDIT what you see in these blocks of generated code !
67 CString m_strOldProfileName;
68 CString m_strOldRegistryKey;
69 CString m_sMyClassName;
71 bool m_bMyClassRegistered;
73 void SetMyClass(const CString &sMyClassName,UINT nIconID);
74 LPCTSTR GetMyClass() const;
75 bool IsMyClassRegistered() const;
78 inline bool CUIApp::IsMyClassRegistered() const
80 return m_bMyClassRegistered;
83 inline void CUIApp::SetMyClass(const CString &sMyClassName,UINT nIconID)
85 m_sMyClassName = sMyClassName;
89 inline LPCTSTR CUIApp::GetMyClass() const
91 return m_sMyClassName;
94 /////////////////////////////////////////////////////////////////////////////
95 class CTRL_EXT_CLASS CAppReg
98 CAppReg(CWinApp *pApp,LPCTSTR szRegistryKey,LPCTSTR szProfileName);
100 CString GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault = NULL );
101 BOOL WriteProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue );
106 inline BOOL CAppReg::WriteProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue )
108 return m_pApp->WriteProfileString(lpszSection,lpszEntry,lpszValue);
111 inline CString CAppReg::GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault)
113 return m_pApp->GetProfileString(lpszSection,lpszEntry,lpszDefault);