大家好:
在继承CEdit控件写了一个自义消息(userMesage),当KeyUp响应时就发送userMessage消息。
但,需要把该控件用在对话框中,怎样才能把userMessage消息在对话框也能使用(消息在外部可见)?请多多指教,在线急等!!
在继承CEdit控件写了一个自义消息(userMesage),当KeyUp响应时就发送userMessage消息。
但,需要把该控件用在对话框中,怎样才能把userMessage消息在对话框也能使用(消息在外部可见)?请多多指教,在线急等!!
解决方案 »
- 关于TransmitFile的问题
- WINDOWS网络编程 原代码 编译通不过是为何?
- 在线等!!Unhandled exception at 0x00430f59 in test.exe: 0xC0000005: Access violation reading location 0x656761cd.
- 请教如何在VC中调用EXCEL宏.....
- FTP服務器如何主動連接客戶端
- 请聊一聊CArray、CList、CMap的效率问题,发表意见者有分!
- 提醒版主注意:目前的论坛人气太差了!
- ado方法,怎么将Ctime类型赋值给_variant_t 类型?
- windows 2000和win98的打印编程问题
- VC++该怎样学?
- 大家好!怎样在输出整数时左补零?
- 怎么判断是不是iframe?
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if ( CMDIFrameWnd::OnCreateClient(lpcs, pContext) )
{
m_wndMDIClient.SubclassWindow(m_hWndMDIClient);
return TRUE;
}
else
return FALSE;
}
就在你消息里写就可以了
//#include "stdafx.h"
#include "Project1.h"
#include "EditCls.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// EditClsEditCls::EditCls()
{
SubclassWindow(this->GetSafeHwnd());
}EditCls::~EditCls()
{
}
BEGIN_MESSAGE_MAP(EditCls, CEdit)
//{{AFX_MSG_MAP(EditCls)
ON_WM_KEYUP()
ON_MESSAGE(WM_USER_KEYUPS, OnKeyUps)
//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// EditCls message handlersvoid EditCls::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
SendMessage(WM_USER_KEYUPS);
CEdit::OnKeyUp(nChar, nRepCnt, nFlags);}void EditCls::OnKeyUps(WPARAM wParam,LPARAM lParm)
{
this->SubclassWindow(this->GetSafeHwnd());
AfxMessageBox("Hello");
}
CMyEdit m_edit;
m_edit.SubClassWindow(GetDlgItem(IDC_EDIT)->m_hWnd);
这样就OK了;
QQ:516681534
可能对话框把消息给捕获了,而不是CEdit