?? clientdlg.cpp
字號:
/////////////////////////////////////////////////////////////////////////////
// ShapeCtl.cpp : Implementation of CShapeCtl
//
// A Simple ActiveX Control
//
// All rights reserved.
//
// Written by Naveen Kohli (naveen@a3ds.com)
// Version 1.0
//
// Distribute freely, except: don't remove my name from the source or
// documentation (don't take credit for my work), mark your changes (don't
// get me blamed for your possible bugs), don't alter or remove this
// notice.
// No warrantee of any kind, express or implied, is included with this
// software; use at your own risk, responsibility for damages (if any) to
// anyone resulting from the use of this software rests entirely with the
// user.
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
// naveen@a3ds.com
/////////////////////////////////////////////////////////////////////////////
// ClientDlg.cpp : Implementation of CClientDlg
#include "stdafx.h"
#include "ClientDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CClientDlg
//
// Function:
// CClientDlg()
//
// Parameters;
//
// Return Values:
//
// Comments:
// Class constructor..
//
CClientDlg::CClientDlg()
{
}
//
// Function:
// OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
//
// Parameters;
//
// Return Values:
// S_OK Successful property page intialization
// E_FAIL Error in property page intialization
//
// Comments:
// Function handles the dialog box intialization.
//
LRESULT
CClientDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
HRESULT hr = E_FAIL;
// Cache the pointer to shape control.
m_ShapeCtlWnd = GetDlgItem (IDC_SHAPECTL);
// Get the unknown pointer.
AtlAxGetControl (m_ShapeCtlWnd, (IUnknown **) &m_pShapeCtl);
// Make the connecton to control's IControlContainer interface.
AtlAdviseSinkMap (this, TRUE);
return 1; // Let the system set the focus
}
//
// Function:
// OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
//
// Parameters;
//
// Return Values:
// S_OK Successful property page intialization
// E_FAIL Error in property page intialization
//
// Comments:
// Function handles the click on OK button.
//
LRESULT
CClientDlg::OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
return 0;
}
//
// Function:
// OnCancel (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
//
// Parameters;
//
// Return Values:
// S_OK Successful property page intialization
// E_FAIL Error in property page intialization
//
// Comments:
// Function handles the click on Close button.
//
LRESULT
CClientDlg::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
AtlAdviseSinkMap (this, FALSE);
DestroyWindow ();
PostQuitMessage (0);
return 0;
}
//
// Function:
// OnClickInShapectl(LONG x, LONG y)
//
// Parameters;
// x x-coordinate of the point of click
// y y-coordinate of the point of click
//
// Return Values:
//
// Comments:
// Function handles the click inside the control region. This event is fired by the control.
// The dialog box captures this message by the IDispatch interface implemented by container.
// The control paases back the x-y coordinates of the point where mouse click took place.
//
VOID __stdcall
CClientDlg::OnClickInShapectl(LONG x, LONG y)
{
HRESULT hr = E_FAIL;
short radius = 70;
// Get the present radius value of the control.
hr = m_pShapeCtl->get_Radius (&radius);
if (FAILED (hr)) {
MessageBox (_T ("Failed to get radius of control"), _T ("Information"), MB_OK);
return;
}
// Increase ht eradius by 5 and then put the new value in control.
radius += 5;
hr = m_pShapeCtl->put_Radius (radius);
if (FAILED (hr)) {
MessageBox (_T ("Failed to change radius of control"), _T ("Information"), MB_OK);
return;
}
}
//
// Function:
// OnClickOutShapectl(LONG x, LONG y)
//
// Parameters;
// x x-coordinate of the point of click
// y y-coordinate of the point of click
//
// Return Values:
//
// Comments:
// Function handles the click outside the control region. This event is fired by the control.
// The dialog box captures this message by the IDispatch interface implemented by container.
// The control paases back the x-y coordinates of the point where mouse click took place.
//
VOID __stdcall
CClientDlg::OnClickOutShapectl(LONG x, LONG y)
{
HRESULT hr = E_FAIL;
short radius = 70;
hr = m_pShapeCtl->get_Radius (&radius);
if (FAILED (hr)) {
MessageBox (_T ("Failed to change radius of control"), _T ("Information"), MB_OK);
return;
}
radius -= 5;
hr = m_pShapeCtl->put_Radius (radius);
if (FAILED (hr)) {
MessageBox (_T ("Failed to change radius of control"), _T ("Information"), MB_OK);
return;
}
}
VOID __stdcall
CClientDlg::OnDblClickInShapectl(LONG x, LONG y)
{
MessageBox (_T ("Double Click In"));
}
VOID __stdcall
CClientDlg::OnDblClickOutShapectl(LONG x, LONG y)
{
MessageBox (_T ("Double Click Out"));
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -