80 likes | 179 Views
Presentation On. Visual C ++ Programming Presented To: Ma’am Sadaf Sial Presented By: Muhammad Shoaib Shera Roll No#08-05 Bs(I T) 5 th Semester Deptt Of Information Technology
E N D
PresentationOn Visual C ++ Programming Presented To: Ma’am SadafSial Presented By: Muhammad ShoaibShera Roll No#08-05 Bs(I T) 5th Semester Deptt Of Information Technology B Z University Multan
Program No#09 How can I check which element (like say, Title bar, Close button, Menu bar, Maximize button, System menu, Scroll bar, etc.) of the nonclient area has been clicked? #include<afxwin.h> #include resource.h Class myframe : public CFrameWnd { Public: myframe() { Create(0,”A HittsetExample”,WS_OVERLAPPEDWINDOW] WS_HSCROLL| WS_VSCROLL,rectDefault, 0, MAKEINTRESOURCE (IDR_MENU1)); } Void OnLButtonDown (UNIT flag,Cpoint Pt) { MessageBox(“This is Client area”, “HITTEST”); } Void OnNcLButtonDown (UNIT hittest,Cpoint pt)
Switch (hittest) { Case HTCAPTION: MessageBox (“This is caption bar”, ”HITTEST”); Break; Case HTCLOSE: MessageBox(“This is Close button”, “HITTEST”); DestoryWindow(); Break; Case HTGROWBOX: MessageBox(“This is Restore button”, “HITTEST”); Break; Case HTHSCROLL: MessageBox(“This is horizontal Scroll bar”, “HITTEST”); Braek; Case HTMENU: MessageBox(“This is Menu”, “HITTEST”); Break; Case HTREDUCE: MessageBox(“This is Minimize button”, “HITTEST”); Break; Case HTSYSMENU:
MessageBox(“This is System menu”, “HITTEST”); Break; Case HTVSCROLL: MessageBox (“This is Vertical Scroll bar”, “HITTEST”); Break; Case HTZOOM: MessageBox (“This is Maximize button”, ”HITTEST”); Break; Case HTTOP: MessageBox(“This is Top Border”, “HITTEST”); Break; Case HTBOTTOM: MessageBox(“This is Button Border”, “HITTEST”); Break; Case HTLEFT: MessageBox (“This is Left Border”, “HITTST”); Break; Case HTRIGHT: MessageBox (“This is Right Border”, “HITTEST”); Break; } } DECLARE_MESSAGE_MAP() };
BEGIN_MESSAGE_MAP (“myframe, CframeWnd”) ON_WM_LBUTTONDOWN() ON_WM_NCLBUTTONDOWN() END_MESSAGE_MAP() Class myapp : public CWinApp { Public : Int Intlnstance() { Myframe*p; P=new myframe; P->ShowWindow(1); m_pMainWnd=p; Return 1; } }; Myapp a;
Program No# 10 How do I close an application if the user clicks twice on the caption bar? #include<afxwin.h> Class myframe : public CframeWnd { Public: myframe() { Create (0,”DoubleClick on The Caption Window”); } Switch (hittest) { Case HTCAPTION:
DestroyWindow(); } Countinue……………………………….