⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 macro.h

📁 一个可以读取Access数据库表的简单实例.可应用于办公室系统中.
💻 H
字号:
//=======================================================================================================================
//
//  文件: MACRO.h
//
//  版本: V1.0
//
//  描述:
//
//  作者: 徐力
//
//  创建日期:2003-2-17
//
//  修改历史:	日期		修改内容
//
//
//=======================================================================================================================


#ifndef __MACRO_h__
#define __MACRO_h__



#define SAFE_NEW(p , type) { SAFE_DELETE (p) ; (p)= ( type * ) new type ; assert ( p ) ; } 
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }

//对于CString* 不能用 SAFE_NEW_ARRAY_ZERO。
#define SAFE_NEW_ARRAY( point , type , num ) { SAFE_DELETE_ARRAY ( point ) ; point = ( type * ) new type [ num ] ; assert ( point ) ; }
#define SAFE_NEW_ARRAY_ZERO( point , type , num ) { SAFE_DELETE_ARRAY ( point ) ; point = ( type * ) new type [ num ] ; assert ( point ) ; 	ZeroMemory ( point , num * sizeof ( type ) ) ; }
#define SAFE_DELETE_ARRAY(p) { if(p) { delete [] (p); (p)=NULL; } }

//#define SAFE_NEW_ARRAY( point , type , num ) { SAFE_RELEASE ( point ) ; point = ( type * ) new type [ num ] ; assert ( point ) ; 	ZeroMemory ( point , num * sizeof ( type ) ) ; }
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }


#define	ABS(a)	(((a)<(0)) ? -(a) : (a))
#define	SWAP(a,b) {(a)^=(b)^=(a)^=(b); }

#define MAX(a,b)	        (((a) > (b)) ? (a) : (b))
#define MIN(a,b)         (((a) < (b)) ? (a) : (b))
#define LIMIT(val,l,h)	 ((val)<(l)?(l):(val)<(h)?(h):(val))

#define SHOW_ERROR( X )	MessageBox ( g_hWnd , X , "错误" , MB_OK ) ;

//=================================================================

#define	GETAPP( app )	CReadAdressApp * app = ( CReadAdressApp * ) AfxGetApp () 
#define	MAINFRM			(( CMainFrame * )AfxGetMainWnd())

//=================================================================



#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -