古詩詞大全網 - 成語查詢 - VB中怎麽寫。將窗口置頂的代碼

VB中怎麽寫。將窗口置頂的代碼

用SetWindowPos函數,通用部分聲明:Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const a& = -1

Private Const b& = &H1

Private Const c& = &H2窗體部分:

Private Sub Form_Load()

SetWindowPos Me.hwnd, a, 0, 0, 0, 0, b Or c

End Sub這個是在窗體加載的時候置頂,SetWindowPos Me.hwnd, a, 0, 0, 0, 0, b Or c 是窗體置頂的實現代碼如果妳要按下按鈕就實現指定可以把它添加到command1_click事件中即可