Skip to content

Commit e4d3e7e

Browse files
author
Frank Yang
committed
WM_CLOSE 消息处理调整
1 parent 0d1b0bf commit e4d3e7e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

form.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func (this *Form) init(parent Controller) {
3737
func (this *Form) Center() {
3838
sWidth := w32.GetSystemMetrics(w32.SM_CXFULLSCREEN)
3939
sHeight := w32.GetSystemMetrics(w32.SM_CYFULLSCREEN)
40-
4140
if sWidth != 0 && sHeight != 0 {
4241
w, h := this.Size()
4342
this.SetPos((sWidth/2)-(w/2), (sHeight/2)-(h/2))
@@ -86,10 +85,11 @@ func (this *Form) WndProc(msg uint, wparam, lparam uintptr) uintptr {
8685
w32.SendMessage(this.hwnd, w32.WM_NCLBUTTONDOWN, w32.HTCAPTION, 0)
8786
}
8887
case w32.WM_CLOSE:
89-
w32.DestroyWindow(this.hwnd)
88+
this.onClose.Fire(NewEventArg(this, nil))
89+
return 0
9090
case w32.WM_DESTROY:
9191
w32.PostQuitMessage(0)
92+
return 0
9293
}
93-
9494
return w32.DefWindowProc(this.hwnd, uint32(msg), wparam, lparam)
9595
}

0 commit comments

Comments
 (0)