Monday, January 11, 2010

Practical Exam Program


M.Sc (IT & CA)
Practical Exam Program
for
Shri. M.N. Virani Science College, Rajkot
January - 2010

Date
Time
Subject
15-1-2010
Friday
9:00  A.M. to 10:30 A.M.
P101 : OOP using VC++
2:00  P.M. to 3:30 P.M.
P102 : Web Technology Concepts
16-1-2010
Saturday
9:00  A.M. to 10:30 A.M.
P103 : DBMS & Advanced Database Administration
2:00  P.M. to 3:30 P.M.
P104 : O.S & Network Management
21-1-2010
Thursday
9:00  A.M. Onwards
P105 : Project - I













*For more information Please refer College Notice board.
 




Friday, December 4, 2009

Database Connection Using DAO in VC++

File Name :: DAOConnView.cpp

Coding ::

void CDAOConnView::OnMoveFirst()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->MoveFirst();

UpdateData(FALSE);

}

void CDAOConnView::OnMovePrev()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->MovePrev();

if(m_pSet->IsBOF() == TRUE)

{

MessageBox("First Record","Alert");

m_pSet->MoveFirst();

}

UpdateData(FALSE);

}

void CDAOConnView::OnMoveNext()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->MoveNext();

if(m_pSet->IsEOF() == TRUE)

{

MessageBox("Last Record","Alert" );

m_pSet->MoveLast();

}

UpdateData(FALSE);

}

void CDAOConnView::OnMoveLast()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->MoveLast();

UpdateData(FALSE);

}

void CDAOConnView::OnAdd()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->AddNew();

UpdateData(FALSE);

}

void CDAOConnView::OnSave()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->Update();

UpdateData(FALSE);

}

void CDAOConnView::OnUpdate()

{

// TODO: Add your control notification handler code here

m_pSet->Edit();

}

void CDAOConnView::OnDelete()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->Delete();

m_pSet->Requery();

m_pSet->MoveNext();

UpdateData(FALSE);

}

OLEDB CONNECTION IN VC++

COledb_connectView.h
public:
COledb_connectDoc* GetDocument();
bool flag;



COledb_connectView.cpp
void COledb_connectView::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_oledb_connectSet;
{
CWaitCursor wait;
HRESULT hr = m_pSet->Open();
if (hr != S_OK)
{
AfxMessageBox(_T("Record set failed to open."), MB_OK);
// Disable the Next and Previous record commands,
// since attempting to change the current record without an
// open RecordSet will cause a crash.
m_bOnFirstRecord = TRUE;
m_bOnLastRecord = TRUE;
}
}
m_rollno=m_pSet->m_rollno;
m_marks=m_pSet->m_marks;
COleDBRecordView::OnInitialUpdate();

}
void COledb_connectView::Onfirst()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pSet->MoveFirst();
m_rollno=m_pSet->m_rollno;
m_marks=m_pSet->m_marks;

UpdateData(false);
}

void COledb_connectView::Onlast()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pSet->MoveLast();
m_rollno=m_pSet->m_rollno;
m_marks=m_pSet->m_marks;
UpdateData(false);

}

void COledb_connectView::Oninsert()
{
// TODO: Add your control notification handler code here
UpdateData();
m_rollno=0;
m_marks=0;
UpdateData(false);
}

void COledb_connectView::Onsave()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pSet->m_rollno=m_rollno;
m_pSet->m_marks=m_marks;
if(flag==true)//if flag is true then update operation will perform
{

m_pSet->SetData();
}
else //if flag is true then INSERT operation will perform
{
m_pSet->Insert();
}
flag=false;

UpdateData(false);
}

void COledb_connectView::Onnext()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pSet->MoveNext();
m_rollno=m_pSet->m_rollno;
m_marks=m_pSet->m_marks;

UpdateData(false);
}

void COledb_connectView::Onprevious()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pSet->MovePrev();
m_rollno=m_pSet->m_rollno;
m_marks=m_pSet->m_marks;

UpdateData(false);
}

void COledb_connectView::Onupdate()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pSet->m_rollno=m_rollno;
m_pSet->m_marks=m_marks;
m_pSet->Update();
flag=true;
UpdateData(false);
}

void COledb_connectView::Ondelete()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pSet->Delete();
m_pSet->MoveFirst();

m_rollno=m_pSet->m_rollno;
m_marks=m_pSet->m_marks;
UpdateData(false);

}

Thursday, December 3, 2009

Practical Assignment

M.Sc (IT & CA) Sem – I
Object Oriented Programming using Visual C++
Practical List - II


(1)
Develop GDI application Using Menu and Toolbar to Change Shape and Color.


(2)
Write application for the GDI that use the ColorDialog and FontDialog.



(3)
 Write application for the GDI that use the Bitmap,Icon and Cursor.


(4) 
Write dialog based application that Write and Read data using the Seek() function.  


(5)
Write application that show the FileStatus with Exception Handling.


(6)
Write application that implement Serialization 



(7)
Develop a simple MDI application.



(8)
Develop simple Web Browser using CHtmlView



(9)
Develop application which can perform Insert, Update, Delete, Search using ODBC.



(10)
Develop application which can perform Insert, Update, Delete, Search using DAO.



(11)
Develop application which can perform Insert, Update, Delete, Search using OLEDB.


(12) 
 Develop Simple Active-X program.


Submission Date 

For Theory and Practical Assignment
On or Before 
26 - 12 - 2009 , Saturday 

Monday, November 30, 2009

Dialog Box in The Shape of Circle













BOOL CSonal2Dlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
CDialog::OnInitDialog();
CRect rect;
CRgn hc;
GetWindowRect(&rect);
hc.CreateEllipticRgn(0,0,rect.right,rect.bottom);
SetWindowRgn(hc,true);
return TRUE; // return TRUE unless you set the focus to a control
}

void CSonal2Dlg::OnPaint()
{
if (IsIconic())
{
…………
………....
}
else
{

CPaintDC pDC(this);
CRect rect;
GetClientRect(&rect);
CBrush mybrush;
mybrush.CreateSolidBrush(RGB(255,128,192));
CBrush *oldbrush=pDC.SelectObject(&mybrush);
pDC.FillRect(&rect,&mybrush);
pDC.SelectObject(oldbrush);
pDC.SetBkMode(TRANSPARENT);
CDialog::OnPaint();
}
}

Friday, November 27, 2009

Draw a Triangle

FileName : TriangleView.h

class CTriangleView : public CView
{
 ...
 CPoint tr[3],ct;
 int rad;
 double rd;
 CRect rc;
...
};


FileName : TriangleView.cpp


 #include "math.h"
...

CTriangleView::CTriangleView()
{
    // TODO: add construction code here
    rd=0.0174532935;
}

void CTriangleView::OnDraw(CDC* pDC)
{
    CTriangleDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    // TODO: add draw code for native data here
    int i=0;
    GetClientRect (rc);
    ct.x = (rc.left + rc.right )/2;
    ct.y = (rc.top + rc.bottom )/2;
    rad=ct.x/2;
    while(i<3)
    {
    tr[i].x = ct.x + rad * sin(i*120*rd);
    tr[i].y = ct.y - rad * cos(i*120*rd);
    i++;
    }
    pDC->Polygon (tr,3);
}

void CTriangleView::OnLButtonDown(UINT nFlags, CPoint point)
{
    // TODO: Add your message handler code here and/or call default
    int i=0;
   
    CClientDC *pDC = new CClientDC (this);
    ct.x = point.x;
    ct.y = point.y;
    rad=20;
    while(i<3)
    {
    tr[i].x = ct.x + rad * sin(i*120*rd);
    tr[i].y = ct.y - rad * cos(i*120*rd);
    i++;
    }
    pDC->Polygon (tr,3);
    CView::OnLButtonDown(nFlags, point);
}

Saturday, November 21, 2009

How to Change Cursor in VC++? Different Type of Cursor

*.header

public:
bool c1,c2,c3,c4;

*.cpp

void CCursor1View::OnMouseMove(UINT nFlags, CPoint point)
{

if(c1)
{
::SetCursor (::LoadCursor (NULL,IDC_CROSS));
}
else if(c2)
{
::SetCursor(::LoadCursor (NULL,IDC_APPSTARTING));
}
else if(c3)
{
::SetCursor (::LoadCursor (NULL,IDC_HELP));
}
else if(c4)
{
::SetCursor (::LoadCursor (NULL,IDC_WAIT));
}

}


void CCursor1View::OnMouseeventCross()
{
// TODO: Add your command handler code here

c1=true;
c2=false;
c3=false;
c4=false;

}

void CCursor1View::OnMouseeventAppstarting()
{
// TODO: Add your command handler code here
c1=false;
c2=true;
c3=false;
c4=false;


}

void CCursor1View::OnMouseeventHelp()
{
// TODO: Add your command handler code here
c1=false;
c2=false;
c3=true;
c4=false;

}

void CCursor1View::OnMouseeventWait()
{
// TODO: Add your command handler code here
c1=false;
c2=false;
c3=false;
c4=true;


}


you can also select this cursor:

1.IDC_APPSTARTING
2.IDC_ARROW
3.IDC_CROSS
4.IDC_HAND
5.IDC_HELP
6.IDC_ICON
7.IDC_NO
8.IDC_SIZE
9.IDC_SIZEALL
10.IDC_SIZENESW
11.IDC_SIZENS
12.IDC_SIZENWSE
13.IDC_SIZEWE
14.IDC_UPARROW
15.IDC_WAIT

Serialize : File Handling using CArchive

--write into file--
*.cpp

void CDLGSerializeDlg::OnWRITE()
{
// TODO: Add your control notification handler code here
CFile cf;
UpdateData();
cf.Open("D:\\test.txt",CFile::modeCreate|CFile::modeWrite);
CArchive ar(&cf,CArchive::store);
Serialize(ar);
//ar.WriteString(m_ftxt);
m_ftxt="";
ar.Flush();
cf.Close();
UpdateData(FALSE);

}

--read--

void CDLGSerializeDlg::OnREAD()
{
// TODO: Add your control notification handler code here
CFile cf;
//char data[50];
UpdateData();
cf.Open("D:\\test.txt",CFile::modeRead);
CArchive ar(&cf,CArchive::load);
Serialize(ar);
/*
ar.Read(data,cf.GetLength());
for(unsigned int i=0;i<< m_ftxt; } else { // loading code ar >> m_ftxt;
}

}


Friday, November 20, 2009

VC++ Code For Drawing Analog and Digital Clock




//CGDIClockView.h
class CGDIClockView : public CView
{
...
// Attributes
public:
      CString str;
      bool start;
 ...
};

// CGDIClockView.cpp
 CGDIClockView::CGDIClockView()
{
    // TODO: add construction code here
    start=false;
}

void CGDIClockView::OnStart()
{
    // TODO: Add your command handler code here
    start = true;

    int x=125,y=125;
    int a=125,b=50;
    int r=75;
    long int i=0,m=0,s=0,h=0;
    int j=12;
    double dtor=0.0174532935;

    CClientDC *pDC = new CClientDC (this);
   
    CPen cp;
    cp.CreatePen(2,1,RGB(255,0,255));
    pDC->SelectObject(&cp);
//Draw Clock

   

while(start)
  {
 

    cp.DeleteObject();
    cp.CreatePen(PS_SOLID,1,RGB(0,0,0));
    pDC->SelectObject(&cp);
   
    //Code for Drawing Circle with Number 1 to 12
    pDC->Ellipse (10,10,240,240);
    while(i<360)
    {
    a = x - x * sin(i*dtor);
    b = y - y * cos(i*dtor);
    str.Format("%d",j);
    pDC->TextOut(a-3,b-3,str);
    j--;
    i=i+30;
    }

    //Code for Drawing Second Hand
    cp.DeleteObject();
    cp.CreatePen(1,2,RGB(255,0,0));
    pDC->SelectObject(&cp);
   
    a = 125 + 110 * sin(s*dtor);
    b = 125 - 110 * cos(s*dtor);
   
    pDC->MoveTo(a,b);
    pDC->LineTo(x,y);
   
   
   //Code for Drawing Minute Hand
    cp.DeleteObject();
    cp.CreatePen(1,2,RGB(0,255,255));
    pDC->SelectObject(&cp);

       a = 125 + 90 * sin(m*dtor);
       b = 125 - 90 * cos(m*dtor);
   
    pDC->MoveTo(a,b);
    pDC->LineTo(x,y);

    //Code for Drawing Hour Hand
    cp.DeleteObject();
    cp.CreatePen(1,3,RGB(255,255,0));
    pDC->SelectObject(&cp);
   
    a = 125 + 70 * sin(h*dtor);
        b = 125 - 70 * cos(h*dtor);
   
    pDC->MoveTo(a,b);
    pDC->LineTo(x,y);
   
    s=s+6;
   
    str.Format("Hour : %ld Min : %ld Second : %ld",((s/6)/3600)%24,((s/6)/60)%60,(s/6)%60);
    pDC->TextOut (20,300,"                                                   ",50);
    pDC->TextOut (20,300,str);
    Sleep(500);
   
    //Code for Incrementing Value of Minute and Hour as per value of Seconds
    if(s%360==0 && s>0)
    {
       m=m+6;

       if(m%72==0 && m>0)
       {
          h=h+6;
       }

    }

    //Code for Reseting All Values after 24 Hours
    if(s==86400)
    {
       s=0;
    }

    Sleep(500);
    UpdateWindow();
   
  }
}

void CGDIClockView::OnStop()
{
    // TODO: Add your command handler code here
    start=false;
}

Wednesday, November 18, 2009

VC++ File Handling : Reading File from Particular Position Using Seek( ) Function





void CFile1Dlg::OnWrite()

{

// TODO: Add extra validation here

UpdateData();
CFile cf;
char ch[100];
cf.Open("d://aits.txt",CFile::modeCreateCFile::modeWrite);
strcpy(ch,m_edit1);
cf.Write(ch,m_edit1.GetLength());
cf.Close();
m_edit1="";
UpdateData(FALSE);


}

void CFile1Dlg::OnRead()
{

// TODO: Add your control notification handler code here
UpdateData();
if(m_pos1==0)
{
MessageBox("please enter position other wise start reading from begining of file");
}

pos=m_pos1;

CFile cf;
char ch[100];
cf.Open("d://aits.txt",CFile::modeRead);

cf.SeekToBegin();
cf.Seek(pos,CFile::begin);
cf.Read(ch,cf.GetLength());

m_edit1="";
for(unsigned int i=0;i

{
m_edit1+=ch[i];
}

cf.Close();
UpdateData(FALSE);
}

VC++ File Handling : Code for Reading And Writing Data from File.




void CFile1Dlg::OnWrite()
{

// TODO: Add extra validation here
UpdateData();
CFile cf;
char ch[100];
cf.Open("d://aits.txt",CFile::modeCreateCFile::modeWrite);
strcpy(ch,m_edit1);
cf.Write(ch,m_edit1.GetLength());
cf.Close(); m_edit1="";
UpdateData(FALSE);
}
void CFile1Dlg::OnRead()
{

// TODO: Add your control notification handler code here
CFile cf;
char ch[100];
UpdateData();
cf.Open("d://aits.txt",CFile::modeRead);
cf.Read(ch,cf.GetLength());
for(unsigned int i=0;i
{

m_edit1+=ch[i];
}
cf.Close();
UpdateData(FALSE);
}

Tuesday, November 17, 2009

How to Write a Program in Exam?

(1) Program or Question Title.
(2)Design




(3) Control Information.

Control Type
Control Name / ID
Member Variable Name
Variable Type
Validation / Extra Info.
EditBox
IDC_EDIT1
m_op1
int
value in[0,100]
EditBox
IDC_EDIT2
m_op2
int
value in[0,100]
EditBox
IDC_EDIT3
m_ans
int
value in[0,200]
Button
IDOK



Button
IDCANCEL




(4) Coding.

Filename : TempDlg.cpp



void CTempDlg::OnOK()
{
            UpdateData();
            m_ans=m_op1+m_op2;
            UpdateData(FALSE);
}         


* If you have done any initialization write with file and function/class structure.
** Always write the function signature in Code.

Monday, November 16, 2009

VC++ (Visual C++) Program List for Submission

 
M.Sc (IT & CA) Sem – I
Object Oriented Programming using Visual C++
List of Practical

----------------------------------------------------------------------------------

(1)
Create Dialog based Application with command button and MessageBox () (Use all Parameters) to print the message with no of clicks whenever user clicks on command button.
(2)

Develop Calculator using Dialog.
Hint: 1 Edit Box, 4 Radio Buttons,
Error Message like Divide by 0 Error,
Use Appropriate Controls.
(3)
Create Dialog based Application as shown below with use of ListBox (3a) and ComboBox.(3b)

(4)
Create Dialog based Applications with two EditBox to show use of different String function and Show final answer in MessageBox.
Hint: 2 EditBox, Radio Buttons (Min 5), CheckBox (Min 5)
Create all Controls through Coding.
(5)
Create Dialog based Applications with multiple Dialog Box to Show functionality of ProgressBar and Slider.
Hint: 3 DialogBox ,
1-> Create and Send Message (Slider)
2-> Show the Status of Message (Progress Bar)
3-> Read Message
* If Possible Implement Vice-Versa and Use Animation.
(6)
Create Dialog based Application with Multiple Dialog box.

Create Dynamic Static Box in 1st Dialog with following values.
* Position where user press Left Button.
* Caption = Text in EditBox of 2nd Dialog Box.
(7)
Write a program to draw a line using three different mouse events.
Hint:

1-> LBUTTONDOWN
2-> LBUTTONUP
3-> MOUSEMOVE
(8)
Write a program to draw a circle, a polygon and a rectangle in the client area. Create your own pen and brush. Each shape should be drawn with different pen and brush.
(9)
Write a program to Animate Circle.
Hint:

* Circle should be Moved from one Point to Another.
* While Moving towards another Point its size should be Changed.
(10)
Write a program to Make Simple Text Editor.
Hint:

* Use Virtual Key.
* User Can Enter and Edit Text.

Submission Date : 15-Nov-2009

VC++ Practical List - Done in Class and LAB

List of Practical For LAB


(1) TAKE TWO EDITBOX ENTER VALUE IN IT AND PRINT THE ADDITION OF THE VALUE IN THIRD EDITBOX BY CLICK ON BUTTON.

(2) WRITE A PROGRAM TO ENABLE & DISABLE EDIT BOX.

(3) WRITE A PROGRAM TO CREATE TWO EDIT BOX DYNAMICALLY & THEN SWAP THE VALUE OF EDIT BOX WHEN CLICK ON BUTTON.

(4) WRITE A PROGRAM TO SWAP THE VALUE OF STATICBOX & EDITBOX.

(5) STRING MANIPULATION ON SELECTION OF RADIO BUTTON
  - CHANGE INTO UPPER CASE
  - CHANGE INTO LOWER CASE
  - REVERSE THE STRING
  - CALCULATE CHARACTER IN STRING
  - MAKE STRING IN PROPER CASE

(6) WRITE A PROGRAM TO DEVELOP SIMPLE CALCULATOR.

(7) WRITE A PROGRAM TO SPLIT THE SENTENCE ENTER IN TEXTBOX TO LIST BOX
HINT : TEXT BOX: "THIS IS MY BOOK"
 LIST BOX:   THIS
                        IS
                        MY
                        BOOK

(8) TAKE TWO LIST BOX AND TRANSFER VALUES ONE LISTBOX TO ANOTHER LISTBOX ONE BY ONE AND ALL AT ONCE WHEN USER CLICKS TWO DIFFERENT BUTTONS RESPECTIVELY.
(Develop Same Application Using COMBOBOX Also)

(9) WRITE A PROGRAM TO IMPLEMENT SCROLLBAR AND PRINT THE POSITION OF SCROLLBAR IN NON CLIENT AREA. (TITLE BAR OF DIALOG)

(10) MAKE AN APPLICATION OF SALES DETAIL WHICH CONTAIN FOLLOWING DETAIL.
 - ITEM NAME
 - ITEM PRICE
 - QUANTITY
 - TOTAL AMOUNT.

(11) MAKE YOUR OWN FUCTION AND MAP IT WITH ANY WINDOWS OR CONTROL EVENT USING MESSAGE MAP.

(12) PRINT CURRENT CURSOR POSITION INTO EDITBOX AND ON TITLEBAR.

(13) PRINT TEXT FROM EDITBOX WHERE USER CLICK ON SCREEN.

(14) Create Dialog based Applications with multiple Dialog Box to Show functionality of ProgressBar and Slider.
Hint: 3 - DIALOGBOX,
          1-> Create and Send Message (Slider)
          2-> Show the Status of Message (Progress Bar)
          3-> Read Message

(15) DRAW LINE USING ALL MOUSE EVENTS.
    (1) BUTTONDOWN AND BUTTONUP
    (2) MOUSEMOVE

(16) Write a program to draw a circle, a polygon and a rectangle in the client area. Create your own pen and brush. Each shape should be drawn with different pen and brush.

(17) Write a program to Animate Circle OR Rectangle.
Hint: * Circle should be Moved from one Point to Another.
            * While Moving towards another Point its size AND COLOR   should be Changed.

(18) Write a program to draw a circle, a polygon and a rectangle in the client area. Shape should be selected from Menu or Toolbar.(Create New Menu and Buttons in Toolbar)

(19) Write a program to change font using font Dialog.

(20) Write a Program to Change Color of Text, Pen and Brush using Color Dialog.