P. 1


|Views: 0|Likes:
Published by sbalajisathya

More info:

Categories:Types, Research
Published by: sbalajisathya on Apr 17, 2013
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PPTX, PDF, TXT or read online from Scribd
See more
See less






  • VC++ Splitter Windows & DLL
  • Splitter Window
  • CsplitterWnd Methods
  • CSplitterWnd methods
  • Steps: Dynamic splitter window
  • View menu split option added use it
  • MainFrm.cpp -
  • Dynamic linked library
  • Dynamic Linked Libraries
  • DLL
  • Dll
  • Program1: create dll
  • Select regular dll using shared mfc dll
  • Insert->new class->Create generic class
  • Add method and member variable
  • Implement the function
  • Add components to that form
  • Cont
  • Call the dll function use it
  • Database access through odbc
  • Crecordset methods
  • Cdatabase
  • Use app wizard
  • Select sdi and doc view architecture
  • Select database view with file support
  • Add
  • edit
  • delete
  • movefirst
  • Execute sql

VC++ Splitter Windows & DLL

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 );

• This method is used to create static splitter window

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

Steps: Dynamic splitter window .

Select advanced button… .

Enable use split window option in window style tab .

View menu split option added use it. Drag the adjust the size of the window .

//main window 2. } • If we want to add any text to the window add text to theondraw method present in the view. //adjust row 2.MainFrm. //adjust col CSize(10. 10). CCreateContext* pContext) { return m_wndSplitter.Create(this.cpp • BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/. //adjust size of the pane pContext //ccreatecontext str var ).cpp class file .

Dynamic linked library Library 1.Dynamic library At the time loading into the memory the library will be linked .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.

use that dll file in the dialog or other appln .Dynamic Linked Libraries  DLL program(MFC app wizard dll) create dll file  Another program (MFC app wizard exe) .

.  Copied into folder in which program we can use the dll file . The directive should be added before the function prototype..  Execute dll program. • A MFC dll program can export a methods .DLL  Dll program.. 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.variables class methods.  It will produce dll file and lib file in debug folder.int b).

Dll Program1: Dll program generate Dll file & lib file Program2: copied dll file into that debug folder and use it  .

Program1: create dll .

Select regular dll using shared mfc dll .

.so add our user defined class .Insert->new class->Create generic class In this program we export class method and variables.

Add method and member variable .

Add dll export directive to the function prototype .

Implement the function .

Execute program function will be exported in the dll file(debug folder) .

Program2: .

Add components to that form .

1..place the dll and library file to that diloag program debug folder 2.Cont. place class header file area.Add header file info dlg.h #include “area.h (copied from dll program) place it to dialog program folder(avoid compilation error) 3.h” .

Project ->settings->link tab->output/lib modules(add lib file path) .4.

// we invoke class method so we need to create object //rad and result are dialog variables result=obj. • } .circle_area(rad). Carea obj. UpdateData(false).Call the dll function use it • • • • • • • • • void CTestclientDlg::OnButton1() { // TODO: Add your control notification handler code here UpdateData(true).

Database access through odbc • MFC Class used : • CrecordSet • Cdatabase .

Crecordset methods • • • • • • • • Add new() Edit() Update() Delete() Moveprev() Movenext() Movelast() Movefirst() .

Executesql(“string sql query”).Cdatabase Crecordset( Cdatabase *pdatabase=NULL. ) BeginTrans(). Committrans() Rollback() .

• Create msaccess database file • Use obcdad32 assign dsn name for that Two columns Table name book • Bname.Cont..cost .

Use app wizard .

Select sdi and doc view architecture .

Select database view with file support .

Selet datasource button add table using odbc dsn name .

.set.Following table member will be added automatically we can use it(.h) .

.Cdbaseset object also created inView.h we use it..

M_pset->addnew().Add • Add(){ • • • • • Updatedata(true). • } . M_pset->update(). M_pset->m_bname=val1 M_pset->cost=val2.

M_pset->edit().edit • edit(){ • • • • • Updatedata(true). M_pset->m_bname=val1 M_pset->cost=val2. M_pset->update(). • } .

M_pset->m_bname=val1 M_pset->cost=val2. • } . M_pset->delete().delete • delete(){ • • • • Updatedata(true).

• } • Similar way prev. • Val2=M_pset->cost.next. • Val1=M_pset->m_bname.movefirst • movefirst(){ • M_pset->movefirst().last . • UpdateData(false).

Execute sql • Sql(){ • M_pset->m_pdatabase->begintrans().”100”)). • M_pset->m_pdatabase->executesql(insert into book values(“java”. • M_pset->m_pdatabase->committrans(). • M_pset->m_pdatabase->rollback().//catch block use it for undo • } .

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->