UIHandle.h
上传用户:hbzxgg2
上传日期:2009-03-28
资源大小:291k
文件大小:2k
- #pragma once
- #include "global.h"
- DLL_INTERNAL void DrawCurveByDataBuffer ( CDC *pDC, CRect &rcClient, COLORREF clr, BYTE *data, int size, 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 ResotreCursor ();
- // 创建对话框实例模板函数
- template<class T>
- T* 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 ) )
- {
- ActiveWindowAndHoldFocus ( (*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 )
- ActiveWindowAndHoldFocus ( (*pptDlg)->m_hWnd );
- }
- ASSERT ( (*pptDlg) && ::IsWindow ( (*pptDlg)->GetSafeHwnd() ) );
- return (*pptDlg);
- }