Академический Документы
Профессиональный Документы
Культура Документы
Splitter Window
A frame window splitted into several view panes Class: CSplitterWnd
Types: 1. Static splitter window(it can split the window at the time of window is created, after splitting we cannot change the size of the window) 2. Dynamic splitter window(split the window at any time ,after splitting we can change the size of the window also)
CsplitterWnd Methods..
Bool CreateStatic ( Cwnd *parentwnd,// parent frame window Int rows,//number of rows Int cols, //no of cols );
CSplitterWnd methods
Bool create( Cwnd* parentwnd,//parent frame window Int rows, //no of rows Int cols,//no of cols Size s, //size of the pane Ccreatecontext * p //str variable it hold cruntime class member Which is responsible for dynamic splitting ); This method used to create dynamic splitter window
MainFrm.cpp BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext) { return m_wndSplitter.Create(this,//main window 2, //adjust row 2, //adjust col CSize(10, 10), //adjust size of the pane pContext //ccreatecontext str var ); } If we want to add any text to the window add text to theondraw method present in the view.cpp class file
1.Static library In the linking file linked with all associated library file and create a executable file with linked libraries (before loading into the memory all libraries are linked) 2.Dynamic library At the time loading into the memory the library will be linked
DLL
Dll program.. A MFC dll program can export a methods ,variables class methods, class variables into dll file Mark the function prototype ( if it is class function constructor and destructor also marked)using dll export directive __declspec(dllexport) export directive marked as a function that are exported into dll file
Ex: __declspec(dllexport)int add(int a,int b); The directive should be added before the function prototype.. Execute dll program.. It will produce dll file and lib file in debug folder. Copied into folder in which program we can use the dll file
Dll
Program1: Dll program generate Dll file & lib file Program2: copied dll file into that debug folder and use it
In this program we export class method and variables..so add our user defined class
Program2:
Cont..
1.place the dll and library file to that diloag program debug folder 2. place class header file area.h (copied from dll program) place it to dialog program folder(avoid compilation error)
UpdateData(true); Carea obj; // we invoke class method so we need to create object //rad and result are dialog variables result=obj.circle_area(rad); UpdateData(false);
Crecordset methods
Add new() Edit() Update() Delete() Moveprev() Movenext() Movelast() Movefirst()
Cdatabase
Crecordset( Cdatabase *pdatabase=NULL; ) BeginTrans(); Executesql(string sql query); Committrans() Rollback()
Cont..
Create msaccess database file
Use obcdad32 assign dsn name for that Two columns Table name book Bname,cost
Add
Add(){ Updatedata(true); M_pset->addnew(); M_pset->m_bname=val1 M_pset->cost=val2; M_pset->update();
edit
edit(){ Updatedata(true); M_pset->edit(); M_pset->m_bname=val1 M_pset->cost=val2; M_pset->update();
delete
delete(){ Updatedata(true); M_pset->delete(); M_pset->m_bname=val1 M_pset->cost=val2;
movefirst
movefirst(){ M_pset->movefirst(); Val1=M_pset->m_bname; Val2=M_pset->cost; UpdateData(false); } Similar way prev,next,last
Execute sql
Sql(){ M_pset->m_pdatabase->begintrans(); M_pset->m_pdatabase->executesql(insert into book values(java,100)); M_pset->m_pdatabase->committrans(); M_pset->m_pdatabase->rollback();//catch block use it for undo }