Click here to Skip to main content
13,706,450 members
Click here to Skip to main content

Stats

288.6K views
78.1K downloads
225 bookmarked
Posted 30 Dec 2005
Licenced CPOL

Form Designer

, 1 Aug 2009
Component for adding scriptable forms capabilities to an application.
MFCDemo.exe
CSDemo
App.ico
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
CSDemo.suo
DaeDoe.bmp
MFCDemo
MFCDemo.dsp
MFCDemo.odl
MFCDemo.reg
res
DaeDoe.bmp
MFCDemo.ico
MFCDemoDoc.ico
Toolbar1.bmp
Toolbar2.bmp
Toolbar3.bmp
Wand.bmp
VBDemo
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
DaeDoe.bmp
VBDemo.vbp
DDForms.chm
DDForms
Archive
FormEditorItems.rgs
vssver.scc
Constants.scr
DaeDoe.bmp
DDForms.def
DDForms.vcproj
DDForms.vcproj.vspscc
EventSinkPassThrough.rgs
FormEditor.bmp
FormEditor.rgs
FormEditorItemCollection.rgs
FormEditorItemDetails.rgs
FormViewer.bmp
FormViewer.rgs
FormViewerItemCollection.rgs
FormViewerItemDetails.rgs
mssccprj.scc
PropPageExtended.rgs
PropPageFormEditor.rgs
PropPageFormViewer.rgs
PropPageSimpleScriptEditor.rgs
SimpleScriptEditor.bmp
SimpleScriptEditor.rgs
vssver.scc
DDFormsTools
CodeMaxDriver
CodeMaxDriver.rgs
CodeMaxDriver.vcproj
CodeMaxDriver.vcproj.vspscc
CodeMaxDriverps.def
CodeMaxDriverPS.vcproj
CodeMaxDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
CodeSenseDriver
CodeSenseDriver.rgs
CodeSenseDriver.vcproj
CodeSenseDriver.vcproj.vspscc
CodeSenseDriverps.def
CodeSenseDriverPS.vcproj
CodeSenseDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
DDPropPageAll
DDPropPageAll.def
DDPropPageAll.vcproj
DDPropPageAll.vcproj.vspscc
mssccprj.scc
PropPageAll.rgs
vssver.scc
DDUnlock
DDUnlock.vcproj
DDUnlock.vcproj.vspscc
mssccprj.scc
vssver.scc
DDControlPack
DDButton.bmp
DDCheckBox.bmp
DDComboBox.bmp
DDControlPack.rgs
DDControlPack.vcproj
DDControlPack.vcproj.vspscc
DDHorzScrollBar.bmp
DDLabel.bmp
DDListBox.bmp
DDPicture.bmp
DDRadioButton.bmp
DDTextBox.bmp
DDVertScrollBar.bmp
mssccprj.scc
vssver.scc
Redistributables
Ansi
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
Unicode
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
// DDHorzScrollBar.h : Declaration of the CDDHorzScrollBar
//
// Author : David Shepherd
//			Copyright (c) 2003, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#pragma once

#include "resource.h"       // main symbols
#include <atlctl.h>

/////////////////////////////////////////////////////////////////////////////
// IDDHorzScrollBar
[
	object,
	uuid("C00D5EF4-A166-447D-A934-3B91E856C5FC"),
	dual,
	helpstring("IDDHorzScrollBar Interface"),
	pointer_default(unique)
]
__interface IDDHorzScrollBar : public IDispatch
{
	////////////////////////////////////////
	// enabled
	[propget, requestedit, bindable,
		id(DISPID_ENABLED),
		helpstring("")]
	HRESULT Enabled([out, retval] VARIANT_BOOL* pVal);
	[propput, requestedit, bindable,
		id(DISPID_ENABLED),
		helpstring("")]
	HRESULT Enabled([in] VARIANT_BOOL newVal);
	////////////////////////////////////////
	// minimum value
	[propget, requestedit, bindable,
		id(DISPID_MINVALUE),
		helpstring("")]
	HRESULT Min([out, retval] LONG* pVal);
	[propput, requestedit, bindable,
		id(DISPID_MINVALUE),
		helpstring("")]
	HRESULT Min([in] LONG newVal);
	////////////////////////////////////////
	// maximum value
	[propget, requestedit, bindable,
		id(DISPID_MAXVALUE),
		helpstring("")]
	HRESULT Max([out, retval] LONG* pVal);
	[propput, requestedit, bindable,
		id(DISPID_MAXVALUE),
		helpstring("")]
	HRESULT Max([in] LONG newVal);
	////////////////////////////////////////
	// small step
	[propget, requestedit, bindable,
		id(DISPID_SMALLSTEP),
		helpstring("")]
	HRESULT SmallStep([out, retval] LONG* pVal);
	[propput, requestedit, bindable,
		id(DISPID_SMALLSTEP),
		helpstring("")]
	HRESULT SmallStep([in] LONG newVal);
	////////////////////////////////////////
	// large step
	[propget, requestedit, bindable,
		id(DISPID_LARGESTEP),
		helpstring("")]
	HRESULT LargeStep([out, retval] LONG* pVal);
	[propput, requestedit, bindable,
		id(DISPID_LARGESTEP),
		helpstring("")]
	HRESULT LargeStep([in] LONG newVal);
	////////////////////////////////////////
	// value
	[propget, requestedit, bindable,
		id(DISPID_VALUE_NOTDEFAULT),
		helpstring("")]
	HRESULT Value([out, retval] LONG* pVal);
	[propput, requestedit, bindable,
		id(DISPID_VALUE_NOTDEFAULT),
		helpstring("")]
	HRESULT Value([in] LONG newVal);
	////////////////////////////////////////
	// default property
	[propget, nonbrowsable,
		id(DISPID_VALUE),
		helpstring("")]
	HRESULT _Default([out, retval] LONG* pVal);
	[propput, nonbrowsable,
		id(DISPID_VALUE),
		helpstring("")]
	HRESULT _Default([in] LONG newVal);
};

/////////////////////////////////////////////////////////////////////////////
// _IDDHorzScrollBarEvents
[
	uuid("F332CF89-16C0-4F86-9CB1-DA3414048581"),
	dispinterface,
	helpstring("_IDDHorzScrollBarEvents Interface")
]
__interface _IDDHorzScrollBarEvents
{
	[id(1), helpstring("")] HRESULT Change();
	[id(2), helpstring("")] HRESULT Scroll();
};

/////////////////////////////////////////////////////////////////////////////
// CDDHorzScrollBar
[
	coclass,
	threading("apartment"),
	vi_progid("DDControlPack.DDHorzScrollBar"),
	progid("DDControlPack.DDHorzScrollBar.1"),
	version(1.0),
	uuid("192A56C3-7D0E-45CC-85A3-7ED56E0755E8"),
	helpstring("DDHorzScrollBar Class"),
	event_source("com"),
	support_error_info(IDDHorzScrollBar),
	registration_script("control.rgs")
]
class ATL_NO_VTABLE CDDHorzScrollBar :
	public IDispatchImpl<IDDHorzScrollBar>,
	public IPersistStreamInitImpl<CDDHorzScrollBar>,
	public IOleControlImpl<CDDHorzScrollBar>,
	public IOleObjectImpl<CDDHorzScrollBar>,
	public IOleInPlaceActiveObjectImpl<CDDHorzScrollBar>,
	public IViewObjectExImpl<CDDHorzScrollBar>,
	public IOleInPlaceObjectWindowlessImpl<CDDHorzScrollBar>,
	public IPersistStorageImpl<CDDHorzScrollBar>,
	public ISpecifyPropertyPagesImpl<CDDHorzScrollBar>,
	public IQuickActivateImpl<CDDHorzScrollBar>,
	public IDataObjectImpl<CDDHorzScrollBar>,
	public CComControl<CDDHorzScrollBar>
{
private:
	CContainedWindow m_ctlScrollBar;

	__event __interface _IDDHorzScrollBarEvents;

/////////////////////////////////////////////////////////////////////////////
// properties
	LONG					m_Reserved0;			// reserved
	LONG					m_Reserved1;			// reserved
	VARIANT_BOOL			m_Enabled;				// enabled
	LONG					m_MinValue;				// minimum value
	LONG					m_MaxValue;				// maximum value
	LONG					m_SmallStep;			// small step
	LONG					m_LargeStep;			// large step
	LONG					m_Value;				// value

/////////////////////////////////////////////////////////////////////////////
// property change validators
	HRESULT OnSmallStepChanging(LONG newVal);
	HRESULT OnLargeStepChanging(LONG newVal);
	HRESULT OnValueChanging(LONG newVal);

/////////////////////////////////////////////////////////////////////////////
// property change handlers
	void OnEnabledChanged();
	void OnValueChanged();

/////////////////////////////////////////////////////////////////////////////

	// returns the value for the passed scroll position
	LONG ValueFromScrollPos(LONG Pos);
	// returns the scroll position for the passed value
	LONG ScrollPosFromValue(LONG Value);

	// returns the normalised minimum value
	LONG NormalisedMinValue();
	// returns the normalised maximum value
	LONG NormalisedMaxValue();

public:
	CDDHorzScrollBar();

DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct();
	void FinalRelease();

static const TCHAR* GetObjectFriendlyName();

DECLARE_OLEMISC_STATUS(
	OLEMISC_RECOMPOSEONRESIZE |
	OLEMISC_CANTLINKINSIDE |
	OLEMISC_INSIDEOUT |
	OLEMISC_ACTIVATEWHENVISIBLE |
	OLEMISC_SETCLIENTSITEFIRST)

BEGIN_PROP_MAP(CDDHorzScrollBar)
	PROP_DATA_ENTRY("_reserved0", m_Reserved0, VT_I4)
	PROP_DATA_ENTRY("_reserved1", m_Reserved1, VT_I4)
	PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
	PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
	PROP_ENTRY("Enabled", DISPID_ENABLED, CLSID_NULL)
	PROP_ENTRY("MinValue", DISPID_MINVALUE, CLSID_NULL)
	PROP_ENTRY("MaxValue", DISPID_MAXVALUE, CLSID_NULL)
	PROP_ENTRY("SmallStep", DISPID_SMALLSTEP, CLSID_NULL)
	PROP_ENTRY("LargeStep", DISPID_LARGESTEP, CLSID_NULL)
	PROP_ENTRY("Value", DISPID_VALUE_NOTDEFAULT, CLSID_NULL)
	// Example entries
	// PROP_ENTRY("Property Description", dispid, clsid)
	// PROP_PAGE(CLSID_StockColorPage)
END_PROP_MAP()

BEGIN_MSG_MAP(CDDHorzScrollBar)
	MESSAGE_HANDLER(WM_CREATE, OnCreate)
	MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
	MESSAGE_HANDLER(WM_HSCROLL, OnHScroll)
	CHAIN_MSG_MAP(CComControl<CDDHorzScrollBar>)
ALT_MSG_MAP(1)
	// Replace this with message map entries for superclassed ScrollBar
END_MSG_MAP()
// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

// message handlers
	BOOL PreTranslateAccelerator(LPMSG pMsg, HRESULT& hRet);
	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnHScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

// IOleInPlaceObjectWindowless
	STDMETHOD(SetObjectRects)(LPCRECT prcPos,LPCRECT prcClip);

// IViewObjectEx
	DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)

// IDDHorzScrollBar
	IMPLEMENT_CUSTOM_BOOL_PROPERTY(Enabled,m_Enabled,DISPID_ENABLED);
	STDMETHOD(get_Min)(LONG *pVal);
	STDMETHOD(put_Min)(LONG newVal);
	STDMETHOD(get_Max)(LONG *pVal);
	STDMETHOD(put_Max)(LONG newVal);
	IMPLEMENT_CUSTOM_PROPERTY(LONG,SmallStep,m_SmallStep,DISPID_SMALLSTEP);
	IMPLEMENT_CUSTOM_PROPERTY(LONG,LargeStep,m_LargeStep,DISPID_LARGESTEP);
	IMPLEMENT_CUSTOM_PROPERTY(LONG,Value,m_Value,DISPID_VALUE_NOTDEFAULT);
	STDMETHOD(get__Default)(LONG* pVal);
	STDMETHOD(put__Default)(LONG newVal);
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

DaveShep
Web Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180920.1 | Last Updated 1 Aug 2009
Article Copyright 2005 by DaveShep
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid