Im looking for a routine to center a dialog box over other dialog box ...
Posted on 2000-11-15 13:45:00 by unknow
This may not be perfect, but i've been using this: CenterWnd PROC Dest:HWND, Src:HWND LOCAL DestRect:RECT LOCAL SrcRect:RECT invoke GetWindowRect,Dest,ADDR DestRect invoke GetWindowRect,Src,ADDR SrcRect mov eax,DestRect.right sub eax,DestRect.left push eax mov eax,SrcRect.right sub eax,SrcRect.left pop ebx sub ebx,eax shr ebx,1 mov eax,DestRect.bottom sub eax,DestRect.top push eax mov eax,SrcRect.bottom sub eax,SrcRect.top pop ecx sub ecx,eax shr ecx,1 push 0 mov edx,SrcRect.bottom sub edx,SrcRect.top push edx mov edx,SrcRect.right sub edx,SrcRect.left push edx add ecx,DestRect.top push ecx add ebx,DestRect.left push ebx push Src call MoveWindow ret CenterWnd ENDP Note: it doesn't matter which window you center on which window.
Posted on 2000-11-15 17:13:00 by martin
thx, it works ...
Posted on 2000-11-16 14:15:00 by unknow