實現窗口居中顯示的函數是自定義類用戶對象ccuo_thread的對象函數of_center
ccuo_thread
//lpclassname
//lpwindowname
//dwtimeout
Ulong lul_hwnd //存放消息對話框的句柄
Ulong lul_start //計時開始時刻的值
lul_start = GetTickCount ( ) //計時開始
do
//查找頂層窗口
lul_hwnd=FindWindowA ( lpclassname
//找到頂層窗口後
if lul_hwnd <>
//判斷是否已超時
loop while GetTickCount( )-lul_start< dwtimeout
//沒有找到消息對話框
if lul_hwnd =
return false
else
//對話框居中
return of_center (
end if
of_center的重載函數代碼如下
ccuo_thread
return Boolean
//hwndp
//hwndc
int li_x //窗口的X坐標
int li_y //窗口的Y坐標
[
From:http://tw.wingwit.com/Article/program/PB/201311/24549.html