使用 hWnd 屬性來判斷 Windows 指派給目前視窗的唯一長 整數 值 (控制碼) 。 讀取/寫入的 Long。
語法
表達。hWnd
詞 代表 Report 物件的變數。
註解
呼叫 Windows 應用程式開發介面 (API) 函式或其他需要 hWnd 屬性做為引數的外部常式時,請在 Visual Basic 中使用此屬性。 Windows 的許多功能需要目前視窗的 hWnd 屬性值為其中一個引數。
注意事項
[!注意事項] 因為此屬性的值可能會變更程式執行時,不儲存在公用變數的 hWnd 屬性值。
範例
下列範例會使用 hWnd 屬性與 Windows API 的 IsZoomed 函數來決定視窗是否為最大化。
' Enter on single line in Declarations section of Module window.
Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
Sub Form_Activate()
Dim intWindowHandle As Long
intWindowHandle = Screen.ActiveForm.hWnd
If Not IsZoomed(intWindowHandle) Then
DoCmd.Maximize
End If
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。