rt
解决方案 »
- 问问,大家写的程序,程序在例如搜索文件时,界面上在干什么
- 怎么用VC++调试EXE文件啊?
- 求助:如何判断在采用OLEOBJECT 继承的两个树之间拖动节点时,源是哪个树,目的对应的是哪个树?
- 为什么我不能在method中传指针参数
- 计算机启动后,操作系统是2000,如何获得刚才输入用户名和密码
- 如何实现VC.NET还有MYIE2那种多文档 在工具栏可以选择文档的界面
- ado与access连接问题,求救!!!!
- 请教一个JAVA的问题
- 如何获得本机的已经安装的补丁。
- 我想读点TCP/IP源码,不知是读linux的还是FreeBSD的好些?
- 高分,紧急.怎么样用ExtFloodFill的时候,怎么才能得到被Fill的区域.
- 紧急,怎么样才能用给定的字体写一个字符呢?还有怎么样在对话框上用给定的字体显示字符.?
HWND hWndParent, // handle to parent window
WNDENUMPROC lpEnumFunc, // pointer to callback function
LPARAM lParam // application-defined value
);
{
// Do something here ... hWnd = GetWindow(hWnd, GW_HWNDNEXT);
}其中的 API 用 MFC CWnd::GetWindow 代替也可以
CSizeDlg *parent;
struct MyRect pr;
int ttt;
int ppp;
BOOL CALLBACK
EnumChildProc( HWND hwnd, LPARAM lParam )
{
struct MyControlSize *t;
t = &first;
while( t->next )
{
t = t->next;
}
t->next = new struct MyControlSize;
t->next->next = NULL;
t->next->h = hwnd;
t->next->last = t;
RECT r;
::GetWindowRect( hwnd, &r );
t->next->r.left = ( double )r.left;
t->next->r.top = ( double )r.top;
t->next->r.right = ( double )r.right;
t->next->r.bottom = ( double )r.bottom;
return 1;
}BOOL CSizeDlg::OnInitDialog()
{
CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
} // Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
parent = this;
EnumChildWindows( this->m_hWnd, EnumChildProc, 0 );
RECT r;
RECT rr;
GetClientRect( &r );
GetWindowRect( &rr );
ppp = ( rr.right - r.right ) / 2;
ttt = rr.bottom - r.bottom - ppp;
pr.left = ( double ) r.left;
pr.top = ( double )r.top;
pr.right = ( double )r.right;
pr.bottom = ( double )r.bottom;
//Invalidate();
return TRUE; // return TRUE unless you set the focus to a control
}
既然EnumChildWindows()、GetWindow()是Windows API,它当然不会限定要MFC的类
在EnumWindowProc函数的前面加一句:
EnumChildWindows(hwnd, EnumWindowProc, 0);