www.pudn.com > screenmode.zip > Win.asm


;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
;	Programmed by 罗云彬, bigluo@telekbird.com.cn 
;	Website: http://asm.yeah.net 
;	LuoYunBin's Win32 ASM page (罗云彬的编程乐园) 
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
 
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
;	公用子程序部分:窗口部分 
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
_CenterWindow	proto	:DWORD		;将窗口移动到屏幕中间 
;******************************************************************** 
;	将窗口移动到屏幕中间 
;	参数:窗口句柄 
;******************************************************************** 
_CenterWindow	proc	hWnd:DWORD 
		local	@stRectDeskTop:RECT,@stRectWin:RECT 
		local	@dwWidth:DWORD,@dwHeight:DWORD 
 
		invoke	GetWindowRect,hWnd,addr @stRectWin 
		invoke	GetDesktopWindow 
		mov	ebx,eax 
		invoke	GetWindowRect,ebx,addr @stRectDeskTop 
 
		mov	eax,@stRectWin.bottom 
		sub	eax,@stRectWin.top 
		mov	@dwHeight,eax 
		mov	eax,@stRectWin.right 
		sub	eax,@stRectWin.left 
		mov	@dwWidth,eax 
 
		mov	ebx,@stRectDeskTop.bottom 
		sub	ebx,@dwHeight 
		shr	ebx,1 
		mov	ecx,@stRectDeskTop.right 
		sub	ecx,@dwWidth 
		shr	ecx,1 
 
		invoke	MoveWindow,hWnd,ecx,ebx,@dwWidth,@dwHeight,FALSE 
		ret 
 
_CenterWindow	endp