www.pudn.com > SMS.rar > UIHandle.h
#pragma once #include "..\..\global.h" DLL_INTERNAL void DrawCurveByDataBuffer ( CDC *pDC, CRect &rcClient, COLORREF clr, BYTE *data, int size, CBrush *m_pbrsBkGnd=NULL, int nCellSize=1, int nStepX=0 ); DLL_INTERNAL void DeleteInstance ( CWnd **ppWnd ); DLL_INTERNAL CSize GetWorkAreaSize (); DLL_INTERNAL void HandleSpanClick( CWnd *pOwnerWnd, UINT nEditCtrlID, NMHDR* pNMHDR, LRESULT* pResult, int nMaxValue, int nMinValue, int nInterval=1); DLL_INTERNAL BOOL LoadBitmapFromFile(CBitmap &bmp, LPCTSTR lpszBmpPath); DLL_INTERNAL void DrawBitmap ( CBitmap &bmp, CDC *pDC, CRect &rc, BOOL bStretch ); DLL_INTERNAL void SetWaitCursor (); DLL_INTERNAL void RestoreCursor (); DLL_INTERNAL void AutoSizeColumns(CListCtrl *pListCtrl); DLL_INTERNAL void ActiveWindowToForeground( CWnd *pWnd ); DLL_INTERNAL COLORREF GetInverseColor(COLORREF color); DLL_INTERNAL void UpdateMenuState ( CMenu *pMenu, UINT nSubMenuID, UINT fState ); DLL_INTERNAL void SetListSelected(CListCtrl *pListCtrl, int nItem, BOOL bMoveToTop=TRUE, BOOL bGetFocus=TRUE); DLL_INTERNAL void RemarkListSelected ( CListCtrl *pListCtrl, int nItem, BOOL bSelect ); DLL_INTERNAL RECT hwMoveWindow ( CWnd *pDlg, UINT nID, int nLeft, int nTop, int nRight, int nBottom ); DLL_INTERNAL RECT hwMoveWindow ( CWnd *pDlg, CWnd *pCtrl, int nLeft, int nTop, int nRight, int nBottom ); // 创建对话框实例模板函数 templateT* TGetInstance ( T **pptDlg, // 保存对话框指针的指针 UINT nIDTemplate, // 对话框资源 ID CWnd *pParentWnd=NULL, // 父窗口句柄 BOOL bRecreateWhenExist=FALSE, // 对话框存在时是否重新创建,删除已经存在的 BOOL bNotCreateWindow=FALSE, // 不创建窗口,仅仅 New 一个对象 BYTE nShowImmediately=1 // 是否立即显示对话框。0 - 不显示;1 - 显示并激活获取焦点;2 - 仅仅显示,不获取焦点 ) { if ( !pptDlg ) return NULL; if ( *pptDlg ) { if ( bRecreateWhenExist ) { ::DeleteInstance ( (CWnd**)pptDlg ); } else if ( ::IsWindow ( (*pptDlg)->m_hWnd ) ) { ActiveWindowToForeground ( (*pptDlg)->m_hWnd ); return (*pptDlg); } } if ( !(*pptDlg) ) { *pptDlg = new T ( pParentWnd ); } if ( !(*pptDlg) ) return NULL; if ( bNotCreateWindow ) return (*pptDlg); if ( !::IsWindow ( (*pptDlg)->GetSafeHwnd() ) ) { if ( !(*pptDlg)->Create ( nIDTemplate, pParentWnd ) ) { ::DeleteInstance ( (CWnd**)pptDlg ); return NULL; } } if ( nShowImmediately != 0 ) { (*pptDlg)->ShowWindow ( SW_SHOW ); // (*pptDlg)->SetForegroundWindow (); if ( nShowImmediately == 1 ) ActiveWindowToForeground ( (*pptDlg)->m_hWnd ); } ASSERT ( (*pptDlg) && ::IsWindow ( (*pptDlg)->GetSafeHwnd() ) ); return (*pptDlg); }