Click here to Skip to main content
11,492,523 members (66,609 online)
Click here to Skip to main content
Add your own
alternative version

Win32 dialog helpers

, 18 Apr 2003 197.9K 2.5K 72
Easy support for dialog resizing and ActiveX controls
// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers

#include <windows.h>
#include <atlbase.h>
extern CComModule _Module;
#include <atlwin.h>

#include <atlcom.h>
#include <atlhost.h>

#include <commctrl.h>

#include "Templates.h" // collections
#include "ResizableGrip.h"

#pragma warning( disable : 4192 ) 

// windows media player type-library 
#import "c:\winnt\system32\msdxm.ocx"

// web browser type libraries
#import "c:\winnt\system32\shdocvw.dll" // web browser control
#import "c:\winnt\system32\mshtml.tlb" // web browser dom


#define RX 1
#define RY 2
#define RXY RX | RY
#define MX 4
#define MY 8
#define MXY MX | MY

#define BEGIN_SIZINGRULES(grip, hParent) \
	grip.InitGrip( hParent ); \
	grip.ShowSizeGrip();

#define ADDRULE(grip, item, rule) \
	{ \
	HWND hObject##item = GetDlgItem( item ); \
	if ( hObject##item ) \
	{ \
		CResizableControl *pListDynamics = grip.AddDynamicControls(); \
		if (pListDynamics) \
		{ \
			pListDynamics->Init(hObject##item); \
			if ((rule)&RX) pListDynamics->AllowResizeXOnResize(); \
			if ((rule)&RY) pListDynamics->AllowResizeYOnResize(); \
			if ((rule)&MX) pListDynamics->AllowMoveXOnResize(); \
			if ((rule)&MY) pListDynamics->AllowMoveYOnResize(); \
		} \
	} \
	}


#define END_SIZINGRULES

#define DORESIZE(grip) \
	if (grip.GetSafeHwnd()) \
	{ \
		grip.UpdateGripPos(); \
		grip.MoveAndResize(); \
	}

#define MINMAX(x,y) \
    LPRECT pRect = (LPRECT) lParam; \
	\
    int nWidth = pRect->right - pRect->left; \
    if (nWidth<x) pRect->right = pRect->left + x; \
	\
    int nHeight = pRect->bottom - pRect->top; \
    if (nHeight<y) pRect->bottom = pRect->top + y;


// TODO: reference additional headers your program requires here

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Addicted to reverse engineering. At work, I am developing business intelligence software in a team of smart people (independent software vendor).

Need a fast Excel generation component? Try xlsgen.


| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 19 Apr 2003
Article Copyright 2003 by Stephane Rodriguez.
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid