0% found this document useful (0 votes)
13 views29 pages

VC++ Simple Window and Scroll Bar Program

The document describes a VC++ program to create a child window: 1. It defines functions for the window procedure and main window. 2. It initializes structures for window class attributes and messages. 3. It registers the window class, creates the main window, and enters a message loop. 4. The window procedure handles messages like WM_CREATE to create the child window and WM_PAINT to draw text in the child window. 5. When finished, it closes the application window.

Uploaded by

sathya_perumal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views29 pages

VC++ Simple Window and Scroll Bar Program

The document describes a VC++ program to create a child window: 1. It defines functions for the window procedure and main window. 2. It initializes structures for window class attributes and messages. 3. It registers the window class, creates the main window, and enters a message loop. 4. The window procedure handles messages like WM_CREATE to create the child window and WM_PAINT to draw text in the child window. 5. When finished, it closes the application window.

Uploaded by

sathya_perumal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

SIMPLE WINDOW DISPLAY

AIM

To write a VC++ program to create a simple window and to display some text in it with
lines.

ALGORITHM

STEP 1: Develop two functions-Winmain &Wndproc


STEP 2: Define two structures,
MSG-MESSAGE STRUCTURE
WNDCLASS-WINDOWCLASS STRUCTURE
STEP 3: Initialize ten fields of the window class which define the attributes of the window.
STEP 4: Register the wndclass by calling the register class function which requires the pointer to
wndclass as parameter.
STEP 5: Create the window using create window function & return a handle to the window.
STEP 6: Display the window using
ShowWindow-initial mode of the window display
UpdateWindow-to paint the client area
STEP 7: Obtain the messages from the messagequeue using GetMessage function
STEP 8: Perform message translations by TranslateMessage function.
STEP 9: Dispatch the message to the WNDPROC using DispatchMessage function.
STEP 10: Define two structures,
PAINTSTRUCT-Paint structure
RECT-Rectangle structure
STEP 11: Using switch-case handle the messages like
WM_PAINT-To create and paint the client area with the given text
WM_DESTROY-To close the application window
STEP 12: Use DefWindowProc to perform default processing of the messages.
PROGRAM:

#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
szCmdLine,int iCmdShow)
{
Static TCHAR szAppName[]=TEXT(“I LOVE INDIA”);
HWND hwnd;
MSG msg;
WNDCLASS wc;
[Link]=CS_HREDRAW|CS_VREDRAW;
[Link]=WndProc;
[Link]=0;
[Link]=0;
[Link]=hInstance;
[Link]=LoadIcon(NULL,IDI_APPLICATION);
[Link]=LoadCursor(NULL,IDC_ARROW);
[Link]=(HBRUSH)GetStockObject(WHITE_BRUSH);
[Link]=NULL;
[Link]=szAppName;
if(!RegisterClass(&wc))
{
MessageBox(NULL,TEXT(“THIS IS RAM”), szAppName,MB_ICONERROR);
return 0;
}
Hwnd=CreateWindow(szAppName,TEXT(“HAI
BROTHER”),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,iCmdShow);
UpdateWindow(hwnd);
While(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return [Link];
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam,
LPARAM IParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
switch(message)
{
Case WM_CREATE: return 0;
Case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
GetClientRect(hwnd,&rect);
DrawText(hdc,TEXT(“I LOVE MY PARENTS”),-1,&rect,DT_SINGLELINE|DT_CENTER|
DT_VCENTER);
EndPaint(hwnd,&ps);
return 0;
case WM_DESTROY:PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,IParam);
}
RESULT

Thus the VC++ program is written to create a simple window and to display some text
with lines.
BASIC DRAWING

AIM

To write a VC++ program to create basic geometric shapes.

ALGORITHM

STEP 1: Develop two functions-Winmain &Wndproc


STEP 2: Define two structures,
MSG-MESSAGE STRUCTURE
WNDCLASS-WINDOWCLASS STRUCTURE
STEP 3: Initialize ten fields of the windowclass which define the attributes of the window.
STEP 4: Register the wndclass by calling the Registerclass function which requires the pointer to
Wndclass as parameter.
STEP 5: Create the window using Createwindow function & return a handle to the window.
STEP 6: Display the window using
ShowWindow-initial mode of the window display
UpdateWindow-to paint the client area
STEP 7: Obtain the messages from the messagequeue using GetMessage function
STEP 8: Perform message translations by TranslateMessage function.
STEP 9: Dispatch the message to the WNDPROC using DispatchMessage function.
STEP 10: Use the necessary co-ordinates to get the prescribed geometric shapes
STEP 11: Use WM_DESTROY to close the application window.

PROGRAM:
#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
szCmdLine,int iCmdShow)
{
Static TCHAR szAppName[]=TEXT(“I LOVE INDIA”);
HWND hwnd;
MSG msg;
WNDCLASS wc;
[Link]=CS_HREDRAW|CS_VREDRAW;
[Link]=WndProc;
[Link]=0;
[Link]=0;
[Link]=hInstance;
[Link]=LoadIcon(NULL,IDI_APPLICATION);
[Link]=LoadCursor(NULL,IDC_ARROW);
[Link]=(HBRUSH)GetStockObject(WHITE_BRUSH);
[Link]=NULL;
[Link]=szAppName;
if(!RegisterClass(&wc))
{
MessageBox(NULL,TEXT(“THIS IS RAM”), szAppName,MB_ICONERROR);
return 0;
}
Hwnd=CreateWindow(szAppName,TEXT(“HAI
BROTHER”),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,iCmdShow);
UpdateWindow(hwnd);
While(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return [Link];
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam,
LPARAM IParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
switch(message)
{
Case WM_CREATE: return 0;
Case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
GetClientRect(hwnd,&rect);
DrawText(hdc, TEXT(“I LOVE MY PARENTS”),-1,&rect,DT_SINGLELINE|DT_CENTER|
DT_VCENTER);
EndPaint(hwnd,&ps);
return 0;
case WM_DESTROY:PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,IParam);
}

RESULT
Thus the VC++ program is written to display the basic geometric shapes.
SCROLL BAR

AIM
To write a VC++ program to display a scroll bar in the client area.

ALGORITHM
STEP 1: Develop two functions-Winmain &Wndproc
STEP 2: Define two structures,
MSG-MESSAGE STRUCTURE
WNDCLASS-WINDOWCLASS STRUCTURE
STEP 3: Initialize ten fields of the window class which define the attributes of the window.
STEP 4: Register the wndclass by calling the register class function which requires the pointer to
wndclass as parameter.
STEP 5: Create the window using create window function & return a handle to the window.
STEP 6: Display the window using
ShowWindow-initial mode of the window display
UpdateWindow-to paint the client area
STEP 7: Obtain the messages from the messagequeue using GetMessage function
STEP 8: Perform message translations by TranslateMessage function.
STEP 9: Dispatch the message to the WNDPROC using DispatchMessage function.
STEP 10: Use the Scroll bar functions like SB_LINEUP,
SB_LINEDOWN,SB_PAGEUP,SB_PAGEDOWN etc. to scroll the vertical bars displayed in
the output window.
STEP 11: Use the functions SetScrollRange and SetscrollPos
STEP 12: Build and Execute.

PROGRAM
#include<stdafx.h>
#define STRUCT
#include<windows.h>
#define NUMLINES ((int)sizeof Message / sizeof Message[0])
struct
{
int index;
}Message[]={1,2,3,4,5};
HINSTANCE hinst,hprev;
HWND hwnd;
char appname[]="[Link]";

int WINAPI WinMain(HINSTANCE hinst,HINSTANCE hprev,LPSTR cmdline,int cmdshow);


long WINAPI windowproc(HWND hwnd,UINT m,WPARAM w,LPARAM l);

int WINAPI WinMain(HINSTANCE hint,HINSTANCE hprev,LPSTR lpszcmdline,int


icmdshow)
{
MSG msg;
WNDCLASS wc;
char cname[] = "my own win";
[Link]=CS_HREDRAW | CS_VREDRAW;
[Link]=windowproc;
[Link]=0;
[Link]=0;
[Link]=hint;
[Link]=LoadIcon(0,IDI_APPLICATION);
[Link]=LoadCursor(0,IDC_ARROW);
[Link]=static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH));
[Link]=NULL;
[Link]=cname;
RegisterClass(&wc);
hwnd=CreateWindow(cname,"mywindow",WS_OVERLAPPEDWINDOW|
WS_VSCROLL,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hint,NULL);
ShowWindow(hwnd,icmdshow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0)==TRUE)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return [Link];
}
long WINAPI windowproc(HWND hwnd,UINT m,WPARAM w,LPARAM l)
{
HDC hdc;
static int cxchar, cxcaps, cychar, cyclient,ivspos;
RECT rect;
TEXTMETRIC tm;
PAINTSTRUCT ps;
char buff[100];
int i, y;
switch(m)
{
case WM_CREATE:
hdc = GetDC(hwnd);
GetTextMetrics(hdc,&tm);
cychar = [Link] + [Link];
ReleaseDC(hwnd,hdc);
SetScrollRange(hwnd,SB_VERT,0,NUMLINES-1,FALSE);
SetScrollPos(hwnd,SB_VERT,ivspos,TRUE);
return 0;

case WM_SIZE:
cyclient = HIWORD(l);
return 0;

case WM_VSCROLL:
switch(LOWORD(w))
{
case SB_LINEUP:
ivspos -=1;
break;

case SB_LINEDOWN:
ivspos +=1;
break;

case SB_PAGEUP:
ivspos -= cyclient/cychar;
break;

case SB_PAGEDOWN:
ivspos += cyclient/cychar;
break;

case SB_THUMBTRACK:
ivspos = HIWORD(w);
break;

case SB_THUMBPOSITION:
ivspos = HIWORD(w);
break;

default:
break;
}
ivspos = max(0,min(ivspos,NUMLINES-1));
if(ivspos != GetScrollPos(hwnd, SB_VERT))
{
SetScrollPos(hwnd,SB_VERT,ivspos,TRUE);
InvalidateRect(hwnd,NULL,TRUE);
}
return 0;
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
for ( i=0; i < NUMLINES; i++)
{
y = cychar*(i-ivspos);
wsprintf(buff,"%d",Message[i].index);
TextOut(hdc,0,y,buff,strlen(buff));
}
EndPaint(hwnd,&ps);
break;
case WM_DESTROY:
MessageBox(hwnd,"win. des,.","des",MB_OK);
PostQuitMessage(0);
return 0;
}

return DefWindowProc(hwnd,m,w,l);
}

RESULT
Thus a VC++ program is written to display a scroll bar in the client area.
CHILD WINDOW CONTROLS

AIM
MODAL DIALOG BOX

AIM
To write a program in VC++ to display a modal dialog box in the view window.

ALGORITHM
STEP 1: Choose File New MFC AppWizard(exe) and type name of the project as
ModalDialog
STEP 2: Select Single Document and press next
STEP 3: Then accept all the default settings of MFC AppWizard and press finish
STEP 4: Select InsertResourceDialog, a new dialog box will appear with default ID as
IDD_DIALOG1 and default OK and CANCEL buttons.
STEP 5: Delete the cancel button and change the caption of OK button as CLICK ME
STEP 6: Select class wizard from the view menu so that a new dialog box appears, to create a
new dialog- press OK
STEP 7: Type the name for new dialog box as CMessageDlg
STEP 8: Add the message handler for OK button and also add the message handler for
WM_LBUTTONDOWN for the view class
STEP 9: Edit the OnOk function in [Link] and OnLButtonDown in
[Link] to create the dialog box using DoModal() function.
STEP 10: Include the header file #include “MessageDlg.h” in the [Link] file
STEP 11: Then build the program and execute it.
STEP 12: The output appears in which the user cannot work elsewhere unless closing the dialog
box

PROGRAM
[Link]
void CMessageDlg::OnOk()
{
MessageBox(“HELLO”, “WELCOME”,3);
CDialog::OnOk();
}

[Link]
void CModalDialogView :: OnLButtonDown(UINT nFlags, CPoint point)
{
CMessageDlg dlg;
[Link]();
CView::OnLButtonDown(nFlags, point);
}

//Include the header file #include “MessageDlg.h” in [Link]

RESULT
Thus the VC++ program is written to display the modal dialog box.
BITMAP DISPLAY

AIM

To create a VC++ program for displaying the specified bitmap pattern brush on the
output window.

ALGORITHM
STEP 1: Choose File New MFC AppWizard(exe) and type name of the project as
Bitmapbrush.
STEP 2: Select Single Document and press next
STEP 3: Then accept all the default settings of MFC AppWizard and press finish
STEP 4: Select InsertResourceBitmap, and load a bitmap image.
STEP 5: Then edit the OnDraw function in [Link] file.
STEP 6: Then build and execute the program.
STEP 7: The output appears in which the created bitmap is displayed in a specified shape.
PROGRAM

[Link]

Void CBitmapbrushView::OnDraw(CDC* pDC)


{
CBitmapbrushDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CBrush brPattern;
CBitmap Bmp;
CBrush *pBrush;
[Link](IDB_BITMAP1);
[Link](&Bmp);
pBrush= pDC->SelectObject(&brPattern);
pDC->Rectangle(50,50,300,300);
pDC->SelectObject(pBrush);
}
RESULT
Thus the VC++ program is created to display the specified bitmap brush.
SINGLE DOCUMENT INTERFACE AND
MULTIPLE DOCUMENT INTERFACE

AIM
To develop a VC++ program to draw inside the view window in Single Document
Interface (SDI) and in Multiple Document Interface (MDI).

ALGORITHM
STEP 1: Choose File New MFC AppWizard(exe) and type name of the project as Single.
STEP 2: Select Single Document and press next
STEP 3: Then accept all the default settings of MFC AppWizard and press finish
STEP 4: Add the member variables in SingleView.h
STEP 5: Edit the OnDraw function in [Link]
STEP 6: Also add the code for specified geometric shape in LBUTTONDOWN and
RBUTTONDOWN function.
STEP 7: In case of MDI, instead of Single Document, select Multiple Document in the second
step and follow the same procedures.
STEP 7: Build and execute the file
STEP 8: For SDI, the output appears in which the displayed geometric shapes can be resized in
the view window.
STEP 9: For MDI, the output appears in which the displayed geometric shapes can be resized in
the separate window created inside the view window.

PROGRAM
SingleView.h
Public:
int x;
int y;

[Link]
CSinglView::CSingleView()
{
x=50;
y=50;
// TODO: add construction code here

}
void CSingleView::OnDraw(CDC* pDC)
{
CSinglDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->Ellipse(50,50,x,y);
}
void CSingleView::OnLButtonDown(UINT nFlags, CPoint point)
{
CView::OnLButtonDown(nFlags, point);
x += 50;
y += 50;
CClientDC dc(this);
[Link](50,50,x,y);
InvalidateRect(FALSE);

}
void CSingleView::OnRButtonDown(UINT nFlags, CPoint point)
{
CView::OnRButtonDown(nFlags, point);
x -= 50;
y -= 50;
CClientDC dc(this);
[Link](50,50,x,y);
InvalidateRect(FALSE);
}
RESULT
Thus a VC++ program was developed to draw inside the view window in Single
Document Interface (SDI) and in Multiple Document Interface (MDI).
SPLITTER WINDOWS

AIM
To write a program in VC++ to dynamically split the view into four panes with four
separate view objects.

ALGORITHM
STEP 1: Choose File New MFC AppWizard (exe) and type name of the project as Splitter.
STEP 2: Select Single Document and press next
STEP 3: Click the Advanced button in the AppWizard Step4 dialog
STEP 4: Click on the window styles tab, and select Use Split Window
STEP 5: Once the split window check box is clicked, AppWizard adds code to CMainFrame
class of an existing application to add splitter capability.
STEP 6: When AppWizard generates an application with a splitter frame, it includes a Split
option in the project’s View menu and the command ID is ID_WINDOW_SPLIT
STEP 7: The application’s main frame window class has splitter window data member and a
prototype for an overridden OnCreateClient function in MainFrm.h
STEP 8: The application framework calls the CFrameWnd::OnCreateClient virtual member
function when the frame object is created.
STEP 9: Edit the OnDraw function in [Link]
STEP 10: Build and Execute.

PROGRAM
MainFrm.h
Protected:
CSplitterWnd m_wndSplitter;
Public:
Virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext* pContext);
[Link]
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,CCreateContext*
pContext);
{
return m_wndSplitter.Create(this,2,2, CSize(10,10), pContext);
}
[Link]
Void CSplitterView::OnDraw(CDC* pDC)
{
pDC-> TextOut(100,100,”Splitter Window”);
}

RESULT

Thus the program in VC++ is written to dynamically split the view into four panes with
four separate view objects.
TOOLBAR

AIM

To write a program in VC++ to display a toolbar with two special-purpose buttons that
draws square along with the pattern on the view window.

ALGORITHM
STEP 1: Choose File New MFC AppWizard(exe) and type name of the project as ToolBar.
STEP 2: Select Single Document and press next
STEP 3: Then accept all the default settings of MFC AppWizard and press finish.
STEP 4: Use the resource editor to edit the application’s main menu.
STEP 5: In Resource View, double-click on IDR_MAINFRAME under menu and Edit the
IDR_MAINFRAME menu resource to create a menu
STEP 6: Add a menu as Draw, using the menu item properties by specifying &Draw in the
caption box.
STEP 7: Add the menu items as square and pattern in the Draw menu, by specifying its ID as
ID_DRAW_SQUARE (caption: &Square) and ID_DRAW_PATTERN (caption: &Pattern)
STEP 8: Use the resource editor to update the application’s toolbar.
STEP 9: Edit the IDR_MAINFRAME toolbar resource to create a bitmap.
STEP 10: Assign the ID’s as ID_DRAW_SQUARE and ID_DRAW_PATTERN to the two new
buttons.
STEP 11: Use Class Wizard to add CToolBarView view class message handlers for the
COMMAND and UPDATE_COMMAND_UI messages.
STEP 12: Add the necessary data members in ToolBarView.h and edit the functions in
[Link]

PROGRAM
ToolBarView.h
Private:
CRect m_rect;
BOOL m_bSquare;
BOOL m_bPattern;
[Link]

CToolBarView::CToolBarView():m_rect(0,0,100,100)
{
m_bSquare = TRUE;
m_bPattern = FALSE;
}

Void CToolBarView::OnDraw(CDC* pDC)


{
CBrush brush(HS_BDIAGONAL,0L);
if(m_bPattern){
pDC->SelectObject(&brush);
}
else
{
pDC->SelectStockObject(WHITE_BRUSH);
}
if (m_bSquare) {
pDC->Rectangle(m_rect);
}

pDC->SelectStockObject(WHITE_BRUSH);
}

void CToolBar::OnDrawSquare()
{
m_rect += CPoint(25, 25);
InvalidateRect(m_rect);
}
Void CToolBar::OnDrawPattern()
{
m_bPattern ^=1;
}

Void CToolBarView :: OnUpdateDrawSquare(CCmdUI* pCMDUI)


{
pCmdUI->Enable(m_bSquare);
}
Void CToolBar::OnUpdateDrawPattern(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(m_bPattern);
}

RESULT
Thus a program in VC++ is written to display a toolbar with two special-purpose buttons
that draws square along with the pattern on the view window.
STATUS BARS

AIM
To write a program in VC++ to display the status bar in the view window.

ALGORITHM
STEP 1: Choose File New MFC AppWizard(exe) and type name of the project as
StatusBar.
STEP 2: Select Single Document and press next
STEP 3: Then accept all the default settings of MFC AppWizard and press finish
STEP 4: Use the string editor to update the string table resource by selecting the string table on
the resource view.
STEP 5: Double-Click on the empty entry at the end of the list in the string table and add the ID
as ID_INDICATOR_RIGHT (Caption: RIGHT) and ID_INDICATOR_LEFT (Caption: LEFT)
STEP 6: Choose Resource Symbols from the View menu and add the new status bar with ID as
ID_MYOWN_STATUSBAR and accept the default value and press ok
STEP 7: Use Class Wizard to add View menu command handlers in the class CMainFrame
STEP 8: Add the function prototypes to MainFrm.h
STEP 9: Modify the original indicators array in the [Link]
STEP 10: Add the message map entries in the CMainFrame class
STEP 11: Define the necessary functions in the [Link] file
STEP 12: Edit the OnDraw function in [Link] file
STEP 13: Include the following header file at the top of the [Link] file as # include
“MainFrm.h”
STEP 14: Build and execute

PROGRAM
MainFrm.h
afx_msg void OnUpdateLeft(CCmdUI* pCmdUI);
afx_msg void OnUpdateRight(CCmdUI* pCmdUI);
[Link]
static UINT indicators[] = {
ID_SEPERATOR,
ID_SEPERATOR,
ID_INDICATOR_LEFT,
ID_INDICATOR_RIGHT,
};

// Add the following code on OnCreate member function in [Link] along with the existing
code.
if(!m_wndStatusBar.Create(this,WS_CHILD| WS_VISIBLE|
CBRS_BOTTOM,ID_MYOWN_STATUSBAR) \\!
m_wndStatusBar.SetIndicators(indicators,sizeof (indicators)/sizeof(UINT)))
{
TRACE0(“Failed to create statusbar\n”);
Return -1;
}

CMainFrame Class
ON_UPDATE_COMMAND_UI(ID_INDICATOR_LEFT, OnUpdateLeft)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_LEFT, OnUpdateRight)

[Link]
Void CMainFrame::OnUpdateLeft(CCmdUI* pCmdUI)
{
pCmdUI->Enable(::GetKeyState(VK_LBUTTON)<0);
}
Void CMainFrame::OnUpdateRight(CCmdUI* pCmdUI)
{
pCmdUI->Enable(::GetKeyState(VK_RBUTTON)<0);
}

Void CMainFrame::OnViewStatusBar()
{
m_wndStatusBar.ShowWindow((m_wndStatusBar.GetStyle() & WS_VISIBLE)==0);
RecalcLayout();
}

Void CMainFrame::OnUpdateViewStatusBar(CCmdUI* pCmdUI)


{
pCmdUI->SetCheck((m_wndStatusBar.GetStyle() & WS_VISIBLE)!=0);
}

[Link]
Void CStatusBarView:: OnDraw(CDC* pDC)
{
pDC->TextOut(0,0,”watch the status bar”);
}

//include the header file #include “MainFrm.h”

RESULT
Thus a program in VC++ is written to display the status bar in the view window.
ACTIVEX CONTROL

AIM

To write a VC++ program for using Active X Control to display a calendar and to access
various methods with respect to calendar control.

ALGORITHM

You might also like