CWnd* pWnd=GetDesktopWindow();
CWnd *pChildWnd = pWnd->GetWindow(GW_CHILD);
CString strWndTitle ;
CWnd *pPopoTalkWnd = NULL;while ( pChildWnd )
{
pChildWnd->GetWindowText( strWndTitle);
if ( strWndTitle.GetLength() )
{
int nPos = strWndTitle.ReverseFind('-');
CString strTmp = strWndTitle.Right(nPos);
strTmp = strWndTitle ;
if ( strTmp.Compare("登录POPO2004")==0)
// if ( (nPos>0) && (strTmp.Compare("对话")==0))
{
pPopoTalkWnd = pChildWnd ;
{
CWnd *pEditWnd = pPopoTalkWnd->GetWindow(GW_CHILD);
while ( pEditWnd )
{
if ( GetWindowLong( pEditWnd->m_hWnd, GWL_STYLE) & ES_PASSWORD )
{
if ( pEditWnd->IsKindOf( RUNTIME_CLASS( CEdit ) ) )
{
int x = 0 ;//这句永远也执行不到,好奇怪
}
char szPass[255];
pEditWnd->SetWindowText("12345");
// pEditWnd->PostMessage(WM_SETTEXT, 0, (LPARAM)"hello");
CRect rect ;
pEditWnd->GetClientRect(rect);
pPopoTalkWnd->InvalidateRect( &rect, TRUE);
pEditWnd->SendMessage(WM_GETTEXT, 255,(LPARAM)szPass);
//szPass为空,奇怪??
}
pEditWnd->GetWindowText( strWndTitle);//strWndTitle 为空
pEditWnd = pEditWnd->GetWindow(GW_HWNDNEXT);
}
}
}
}
pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);
}不知道哪里有问题,就是不能想密码框填充密码,另外,泡泡对话是, 跟对方聊天的编辑框,如何得到其内容?
CWnd *pChildWnd = pWnd->GetWindow(GW_CHILD);
CString strWndTitle ;
CWnd *pPopoTalkWnd = NULL;while ( pChildWnd )
{
pChildWnd->GetWindowText( strWndTitle);
if ( strWndTitle.GetLength() )
{
int nPos = strWndTitle.ReverseFind('-');
CString strTmp = strWndTitle.Right(nPos);
strTmp = strWndTitle ;
if ( strTmp.Compare("登录POPO2004")==0)
// if ( (nPos>0) && (strTmp.Compare("对话")==0))
{
pPopoTalkWnd = pChildWnd ;
{
CWnd *pEditWnd = pPopoTalkWnd->GetWindow(GW_CHILD);
while ( pEditWnd )
{
if ( GetWindowLong( pEditWnd->m_hWnd, GWL_STYLE) & ES_PASSWORD )
{
if ( pEditWnd->IsKindOf( RUNTIME_CLASS( CEdit ) ) )
{
int x = 0 ;//这句永远也执行不到,好奇怪
}
char szPass[255];
pEditWnd->SetWindowText("12345");
// pEditWnd->PostMessage(WM_SETTEXT, 0, (LPARAM)"hello");
CRect rect ;
pEditWnd->GetClientRect(rect);
pPopoTalkWnd->InvalidateRect( &rect, TRUE);
pEditWnd->SendMessage(WM_GETTEXT, 255,(LPARAM)szPass);
//szPass为空,奇怪??
}
pEditWnd->GetWindowText( strWndTitle);//strWndTitle 为空
pEditWnd = pEditWnd->GetWindow(GW_HWNDNEXT);
}
}
}
}
pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);
}不知道哪里有问题,就是不能想密码框填充密码,另外,泡泡对话是, 跟对方聊天的编辑框,如何得到其内容?
解决方案 »
- MFC42D.LIB : fatal error LNK1112: module machine type "IA64" conflicts
- 编辑框滚屏问题
- 高手看看我这个用webbrowser控件读取内存中的html问题(代码)?
- 学VC++先要学VC吗?请各位好心人给点意见
- 请问高手们CList类后面模板参数的意思
- 如何让Console(DOS窗)程序读取RAW图像。。。。
- 再dll中写这样的程序是不是行不通?
- 如何使登陆对话框不是焦点?
- wininet网络编程,如何获得http状态码
- 为什么同一行代码在win7 32位和XP系统执行的不一样呢?
- 文件另存的问题?
- 怎样重载BOOL CDocManager::DoPromptFileName();这个函数?
{
int x = 0 ;//这句永远也执行不到,好奇怪,就这么一行,没做什么实际工作,被编译器优化掉了吧。
}
m_ctrEdit.SetPasswordChar('*');就可以使编辑框成为密码框了。
关于得到内容的问题要用到UpdateData(TRUE);语句其内容就保存到编辑框的成员变量重量。
可以用AfxMessageBox(m_strValue);//m_strValue是编辑框的成员变量
试试!
你没看明白我的程序的目的吧,老兄!我是通过查找窗口访问其他程序的控件,怎么定义变量?