📄 atlwince.h
字号:
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ADDSTYLE, 0, (LPARAM)pszStyle);
}
#endif // (_WIN32_WCE >= 400)
void AddText(BOOL bPlainText, LPCSTR pszText)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)bPlainText, (LPARAM)pszText);
}
void AddHTML(LPCSTR pszHTML)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)FALSE, (LPARAM)pszHTML);
}
void AddText(BOOL bPlainText, LPCWSTR pszText)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)bPlainText, (LPARAM)pszText);
}
void AddHTML(LPCWSTR pszHTML)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)FALSE, (LPARAM)pszHTML);
}
void Anchor(LPCSTR pszAnchor)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ANCHOR, 0, (LPARAM)pszAnchor);
}
void Anchor(LPCWSTR pszAnchor)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ANCHORW, 0, (LPARAM)pszAnchor);
}
#if (_WIN32_WCE >= 400)
void GetBrowserDispatch(IDispatch** ppDispatch)
{
ATLASSERT(::IsWindow(m_hWnd));
ATLASSERT(ppDispatch);
ATLASSERT(*ppDispatch==NULL);
::SendMessage(m_hWnd, DTM_BROWSERDISPATCH, 0, (LPARAM)ppDispatch);
}
#endif // (_WIN32_WCE >= 400)
void Clear()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_CLEAR, 0, 0L);
}
void EnableClearType(BOOL bEnable = TRUE)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ENABLECLEARTYPE, 0, (LPARAM)bEnable);
}
void EnableContextMenu(BOOL bEnable = TRUE)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ENABLECONTEXTMENU, 0, (LPARAM)bEnable);
}
void EnableScripting(BOOL bEnable = TRUE)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ENABLESCRIPTING, 0, (LPARAM)bEnable);
}
void EnableShrink(BOOL bEnable = TRUE)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ENABLESHRINK, 0, (LPARAM)bEnable);
}
void EndOfSource()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ENDOFSOURCE, 0, 0L);
}
void ImageFail(DWORD dwCookie)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_IMAGEFAIL, 0, (LPARAM)dwCookie);
}
int GetLayoutHeight() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (int)::SendMessage(m_hWnd, DTM_LAYOUTHEIGHT, 0, 0L);
}
int GetLayoutWidth() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (int)::SendMessage(m_hWnd, DTM_LAYOUTWIDTH, 0, 0L);
}
void Navigate(LPCTSTR pstrURL, UINT uFlags = 0)
{
ATLASSERT(::IsWindow(m_hWnd));
ATLASSERT(pstrURL);
::SendMessage(m_hWnd, DTM_NAVIGATE, (WPARAM)uFlags, (LPARAM)pstrURL);
}
void SelectAll()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_SELECTALL, 0, 0L);
}
void SetImage(INLINEIMAGEINFO* pImageInfo)
{
ATLASSERT(::IsWindow(m_hWnd));
ATLASSERT(pImageInfo);
::SendMessage(m_hWnd, DTM_SETIMAGE, 0, (LPARAM)pImageInfo);
}
void ZoomLevel(int iLevel)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_ZOOMLEVEL, 0, (LPARAM)iLevel);
}
#if (_WIN32_WCE >= 400)
void Stop()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, DTM_STOP, 0, 0L);
}
#endif // (_WIN32_WCE >= 400)
void GetScriptDispatch(IDispatch** ppDispatch)
{
ATLASSERT(::IsWindow(m_hWnd));
ATLASSERT(ppDispatch);
ATLASSERT(*ppDispatch==NULL);
::SendMessage(m_hWnd, DTM_SCRIPTDISPATCH, 0, (LPARAM)ppDispatch);
}
};
typedef CHtmlCtrlT<ATL::CWindow> CHtmlCtrl;
#ifdef WIN32_PLATFORM_PSPC
///////////////////////////////////////////////////////////////////////////////
// CRichInkCtrl
template <class TBase>
class CRichInkCtrlT : public TBase
{
public:
// Constructors
CRichInkCtrlT(HWND hWnd = NULL) : TBase(hWnd)
{ }
CRichInkCtrlT< TBase >& operator =(HWND hWnd)
{
m_hWnd = hWnd;
return *this;
}
HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
DWORD dwStyle = 0, DWORD dwExStyle = 0,
ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
{
HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
ATLASSERT(hWnd != NULL); // Did you remember to call InitRichInkDLL() ??
return hWnd;
}
// Attributes
static LPCTSTR GetWndClassName()
{
return WC_RICHINK;
}
BOOL CanPaste(UINT uFormat = 0) const
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, (WPARAM)uFormat, 0L);
}
BOOL CanRedo() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L);
}
BOOL CanUndo() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L);
}
void ClearAll(BOOL bRepaint = TRUE) const
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_CLEARALL, (WPARAM)bRepaint, 0L);
}
BOOL GetModify() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L);
}
UINT GetPageStyle() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (UINT)::SendMessage(m_hWnd, EM_GETPAGESTYLE, 0, 0L);
}
UINT GetPenMode() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (UINT)::SendMessage(m_hWnd, EM_GETPENMODE, 0, 0L);
}
UINT GetViewStyle() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (UINT)::SendMessage(m_hWnd, EM_GETVIEW, 0, 0L);
}
UINT GetWrapMode() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (UINT)::SendMessage(m_hWnd, EM_GETWRAPMODE, 0, 0L);
}
UINT GetZoomPercent() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (UINT)::SendMessage(m_hWnd, EM_GETZOOMPERCENT, 0, 0L);
}
void InsertLinks(LPWSTR lpString, int cchLength = -1)
{
ATLASSERT(::IsWindow(m_hWnd));
if(cchLength == -1)
cchLength = lstrlen(lpString);
::SendMessage(m_hWnd, EM_INSERTLINKS, (WPARAM)cchLength, (LPARAM)lpString);
}
void RedoEvent()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_REDOEVENT, 0, 0L);
}
UINT SetInkLayer(UINT uLayer)
{
ATLASSERT(::IsWindow(m_hWnd));
return (UINT)::SendMessage(m_hWnd, EM_SETINKLAYER, (WPARAM)uLayer, 0L);
}
void SetPageStyle(UINT uStyle)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_SETPAGESTYLE, (WPARAM)uStyle, 0L);
}
void SetPenMode(UINT uMode)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_SETPENMODE, (WPARAM)uMode, 0L);
}
void SetViewStyle(UINT uStyle)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_SETVIEW, (WPARAM)uStyle, 0L);
}
void SetViewAttributes(VIEWATTRIBUTES* pAttribs)
{
ATLASSERT(::IsWindow(m_hWnd));
ATLASSERT(pAttribs);
::SendMessage(m_hWnd, EM_SETVIEWATTRIBUTES, 0, (LPARAM)pAttribs);
}
void SetWrapMode(UINT uMode)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_SETWRAPMODE, (WPARAM)uMode, 0L);
}
void SetZoomPercent(UINT uPercent)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_SETZOOMPERCENT, (WPARAM)uPercent, 0L);
}
LONG StreamIn(UINT uFormat, EDITSTREAM& es)
{
ATLASSERT(::IsWindow(m_hWnd));
return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, (WPARAM)uFormat, (LPARAM)&es);
}
LONG StreamOut(UINT uFormat, EDITSTREAM& es)
{
ATLASSERT(::IsWindow(m_hWnd));
return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, (WPARAM)uFormat, (LPARAM)&es);
}
void UndoEvent()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_UNDOEVENT, 0, 0L);
}
// Standard EM_xxx messages
DWORD GetSel() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L);
}
void GetSel(int& nStartChar, int& nEndChar) const
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar);
}
void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM)bCanUndo, (LPARAM)lpszNewText);
}
void SetModify(BOOL bModified = TRUE)
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, EM_SETMODIFY, (WPARAM)bModified, 0L);
}
int GetTextLength() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L);
}
// Clipboard operations
void Clear()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, WM_CLEAR, 0, 0L);
}
void Copy()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, WM_COPY, 0, 0L);
}
void Cut()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, WM_CUT, 0, 0L);
}
void Paste()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, WM_PASTE, 0, 0L);
}
};
typedef CRichInkCtrlT<ATL::CWindow> CRichInkCtrl;
///////////////////////////////////////////////////////////////////////////////
// CInkXCtrl
template <class TBase>
class CInkXCtrlT : public TBase
{
public:
// Constructors
CInkXCtrlT(HWND hWnd = NULL) : TBase(hWnd)
{ }
CInkXCtrlT< TBase >& operator =(HWND hWnd)
{
m_hWnd = hWnd;
return *this;
}
HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
DWORD dwStyle = 0, DWORD dwExStyle = 0,
ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
{
HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam);
ATLASSERT(hWnd != NULL); // Did you remember to call InitInkX() ??
return hWnd;
}
// Attributes
static LPCTSTR GetWndClassName()
{
return WC_INKX;
}
static UINT GetHotRecordingMessage()
{
return ::RegisterWindowMessage(szHotRecording);
}
void ClearAll()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, IM_CLEARALL, 0, 0L);
}
int GetData(BYTE* lpBuffer, INT cbBuffer) const
{
ATLASSERT(::IsWindow(m_hWnd));
ATLASSERT(lpBuffer);
return (int)::SendMessage(m_hWnd, IM_GETDATA, (WPARAM)cbBuffer, (LPARAM)lpBuffer);
}
int GetDataLen() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (int)::SendMessage(m_hWnd, IM_GETDATALEN, 0, 0L);
}
CRichInkCtrl GetRichInk() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (HWND)::SendMessage(m_hWnd, IM_GETRICHINK, 0, 0L);
}
BOOL IsRecording() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, IM_RECORDING, 0, 0L);
}
void ReInit()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, IM_REINIT, 0, 0L);
}
void SetData(const BYTE* lpInkData, INT cbInkData)
{
ATLASSERT(::IsWindow(m_hWnd));
ATLASSERT(lpInkData);
::SendMessage(m_hWnd, IM_SETDATA, (WPARAM)cbInkData, (LPARAM)lpInkData);
}
void VoicePlay()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, IM_VOICE_PLAY, 0, 0L);
}
BOOL IsVoicePlaying() const
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, IM_VOICE_PLAYING, 0, 0L);
}
BOOL VoiceRecord()
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, IM_VOICE_RECORD, 0, 0L);
}
void VoiceStop()
{
ATLASSERT(::IsWindow(m_hWnd));
::SendMessage(m_hWnd, IM_VOICE_STOP, 0, 0L);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -