Introduction
The core technology is based on Microsoft COM technology.
Simple Introduction
- New software, software function and design of software frame separation
- The COM technology + WTL design
- Automation framework application development, support, support macros language development
- Support plug-in design
- 32 and 64-bit versions
- Support can be defined theme, theme
- Built-in multinational language pack, including language switch
- The UNICODE programming
- The built-in ChengRong application framework "wizard, can generate MFC ATL WTL project applications
- The automatic preservation window coordinates etc. function
Main Frame
An application can have multiple main frames. Each main frame can be a single document, single document window lattice, document portion, document window lattice, points. The framework has ordered the collection, the menu bar and the commands, composed, also can add points window or grid page document. The main frame is set IMainFrames
unified management.
Main frame window coordinates automatic memory.
The ChengRong application framework of application management interface:
IArtApp
interface is the ChengRong application framework of managers, and is the first program execution prior to creating the interface. If you fail to create the ChengRong application framework, it will not work properly.
The Collection Order
The collection ICommandBars
interface command. There is IMenuBar
menu bar and the commands ICommandBar
composition. Command the sidebar, is also called the command here. Food has become a menu commands ICommandBar
bar, a menu item and ordered the button, collectively known as a command interface name is ICommandItem
: ICommandItem
interface with a user can change orders.
Command Processor
Command processor INotifyCommand
interface, user interface to handle INotifyCommand
must realize the main frame, orders, the menu bar, a pop-up menu commands.
The main frame, orders, and ordered a command INotifyCommand
can have the interface.
Command Processor Set
Command processor INotifyCommands
interface is used to manage all the command processors. The main frame, the collection INotifyCommands
interface with orders.
User
- Download SetupSoftGFramework.exe
- Setup...
- Regsvr Type library
- Setup Wizard to Visual Studio 2005 or Visual Studio 2008.
- Run Visual Studio 2005 or Visual Studio 2008.
- Add "SoftG Frame\Include" to "Tools\Options\Projects and Solutions\VC++ Directories"
- New Project
- Click "SoftG Frame"\"MFC Application". Input the item name "
MyProject
." Click OK. - According to guide project:
- Project Info.
File name | Description |
MainCommand.cpp or MainCommand.h | The new command processing mode.
class CMainCommand :
public art::CNotifyCommandImpl<CMainCommand>
{
public:
void OnHelp(UINT nCmdID, art::ICommandItem *pCmdUI);
|
MyProject.cpp or MyProject.h | CMyProjectApp class. Added "Art::CArtApp " base class.
class CMyProjectApp : public CWinApp,
public art::CArtApp
{
|
MyProjectDoc.cpp or MyProjectDoc.h | CMyProjectDoc . No changes
class CMyProjectDoc : public CDocument
{
|
MyProjectView.cpp or MyProjectview.h | CMyProjectView class. Added "art::CDataViewImpl<CMyProjectView> " base classes
class CMyProjectView :
public CView,
public art::CDataViewImpl<CMyProjectView>
{
|
| |
Using the Code
- Initialize "ChengRong application framework" environment:
HRESULT hr = art::CArtApp::InitArtApp();
- Create main frame:
Call IArtApp
interface CreateMainFrame
method of main frame, and create IMainFrame
returns to the main frame adds interfaces, command processor INotifyCommand
interface.
Through the IMainFrame
interface put_SDIDataView
attribute, add data views.
bool CMyProjectApp::CreateSDIWindow()
{
CMainCommand mc;
HRESULT hr = S_FALSE;
HICON hIcon = (HICON)::LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
HMENU hMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
hr = GetArtApp()->CreateMainFrame(art::artMainFrameTypeSDI,
(wireHMENU)hMenu, (long)hIcon, L"Window Name", &m_pMainFrame);
if (S_OK == hr)
{
m_pMainFrame->AddNotifyCommand((art::INotifyCommand*)&mc);
GetArtApp()->put_AppName(L"Software Name");
CreateTools();
CMyProjectView *pDocView = NULL;
pDocView = new CMyProjectView();
m_pMainFrame->put_SDIDataView((art::IDataView*)pDocView);
m_pMainFrame->ShowWindow(SW_SHOW);
GetArtApp()->Run();
return true;
}
return false;
}
- Create
CommandBar
:
Create a command button with three:
void CMyProjectApp::CreateTools()
{
ATLASSERT(NULL != m_pMainFrame);
CComPtr<:icommandbars> pCommandBars;
CComPtr<:icommandbar> pCommandBar;
CComBSTR bstrTitile;
#pragma warning(disable:4309)
#pragma warning(disable:4305)
TBBUTTON tbAdd[] = {
{0, ID_FILE_NEW, TBSTATE_ENABLED,
TBSTYLE_BUTTON|TBSTYLE_TOOLTIPS, 0L, ID_FILE_NEW},
{0, 0, 0, TBSTYLE_SEP, 0L, 0},
{1, ID_FILE_CLOSE, TBSTATE_ENABLED,
TBSTYLE_BUTTON|TBSTYLE_TOOLTIPS, 0L, ID_FILE_CLOSE},
{0, 0, 0, TBSTYLE_SEP, 0L, 0},
{2, ID_HELP, TBSTATE_ENABLED,
TBSTYLE_BUTTON|TBSTYLE_TOOLTIPS, 0L, ID_HELP},
};
#pragma warning(default:4309)
#pragma warning(default:4305)
m_pMainFrame->get_CommandBars(&pCommandBars);
bstrTitile = L"Standard";
pCommandBars->AddCommandBar(bstrTitile, 1, 16, 16, &pCommandBar);
pCommandBar->InsertCommand(0, sizeof(tbAdd)/sizeof(tbAdd[0]), (BYTE*)&tbAdd);
pCommandBar->SetImageList((long)AfxGetResourceHandle(),
16, 16, MAKEINTRESOURCEW(IDR_MAINFRAME));
}
- Command processing:
Command received INotifyCommand
interface. The user must realize INotifyCommand
, according to the method of filling:
Methods | Description |
QueryState(UINT nCmdID,
ICommandItem *pCmdUI);
| query State |
NotifyCommand(UINT codeNotify,
int nCmdID, ICommandItem *pCmdUI);
| |
NotifyCommandPoint(UINT nCmdID, POINT *pt,
ICommandItem *pCmdUI, IDispatch *ppmb);
| |
GetCommandTips(UINT nCmdID, BSTR *bstrTips);
| The standard with full screen with methods. Get orders a hint. |
STDMETHODIMP ExpansionCommand
(UINT nCmdID, ICommandItem *pCmdUI);
| When the call out commands. |
ICommandItem
interface:
virtual HRESULT __stdcall get_Caption (BSTR * pVal );
virtual HRESULT __stdcall put_Caption (BSTR pVal );
virtual HRESULT __stdcall get_Enable (VARIANT_BOOL * pVal );
virtual HRESULT __stdcall put_Enable (VARIANT_BOOL pVal );
virtual HRESULT __stdcall get_Check (VARIANT_BOOL * pVal );
virtual HRESULT __stdcall put_Check (VARIANT_BOOL pVal );
virtual HRESULT __stdcall get_Radio (VARIANT_BOOL * pVal );
virtual HRESULT __stdcall put_Radio (VARIANT_BOOL pVal );
virtual HRESULT __stdcall get_Visible (VARIANT_BOOL * pVal );
virtual HRESULT __stdcall put_Visible (VARIANT_BOOL pVal );
virtual HRESULT __stdcall get_Cmd (unsigned long * nCmdID );
virtual HRESULT __stdcall put_Cmd (unsigned long nCmdID );
virtual HRESULT __stdcall get_index (unsigned long * nIndex );
virtual HRESULT __stdcall get_CommandItemType (enum artCommandItemType * pVal );
virtual HRESULT __stdcall put_CommandItemType (enum artCommandItemType pVal );
virtual HRESULT __stdcall get_Width (long * pVal );
virtual HRESULT __stdcall put_Width (long pVal );
virtual HRESULT __stdcall get_NotifyCommand (IDispatch * * pNotifyCommand );
virtual HRESULT __stdcall put_NotifyCommand (IDispatch * pNotifyCommand );
virtual HRESULT __stdcall get_ItemWindow (wireHWND * phwnd );
virtual HRESULT __stdcall get_CmdHandle (VARIANT_BOOL * pHandle );
virtual HRESULT __stdcall put_CmdHandle (VARIANT_BOOL pHandle );
virtual HRESULT __stdcall get_IconIndex (unsigned long * nIndex );
virtual HRESULT __stdcall put_IconIndex (unsigned long nIndex );
virtual HRESULT __stdcall get_Icon (wireHICON * hIcon );
virtual HRESULT __stdcall put_Icon (wireHICON hIcon );
virtual HRESULT __stdcall get_Bitmap (wireHBITMAP * hBitmap );
virtual HRESULT __stdcall put_Bitmap (wireHBITMAP hBitmap );
virtual HRESULT __stdcall get_ChildCommandBar (ICommandBar * * pCommandBars );
virtual HRESULT __stdcall put_ChildCommandBar (ICommandBar * pCommandBars );
virtual HRESULT __stdcall get_ParentCommandBar (ICommandBar * * pCommandBars );
virtual HRESULT __stdcall IsChildItem (VARIANT_BOOL * pChild );
virtual HRESULT __stdcall CreateCommandBar (ICommandBar * * pCommandBars );
virtual HRESULT __stdcall MoveItem (unsigned long nNewIndex );
History
- 13th May, 2009: Initial post