VB窗體控制示例

2021-04-08 18:56:46 字數 808 閱讀 9182

'以下新增到窗體中

private declare function findwindow lib "user32" alias "findwindowa" (byval lpclassname as string, byval lpwindowname as string) as long

private declare function flashwindow lib "user32" (byval hwnd as long, byval binvert as long) as long

private declare function setwindowtext lib "user32" alias "setwindowtexta" (byval hwnd as long, byval lpstring as string) as long

'以下為按鈕事件中

private sub command1_click()

dim lhwnd as long'holds the handle to the window

'獲取到的窗體名稱

lhwnd = findwindow("minesweeper", "minesweeper")

text1.text = lhwnd

if lhwnd <> 0 then

'閃爍窗體

flashwindow lhwnd, 1

end if

if lhwnd <> 0 then

'改變窗體標題

setwindowtext lhwnd, "我改變了你的窗體的標題啦"

end if

end sub

VB窗體置頂

private declare function setwindowpos lib user32 alias setwindowpos byval hwnd as long,byval hwndinsertafter as long,byval x as long,byval y as long,b...

vb 建立圓角窗體

private declare function setwindowrgn lib user32 byval hwnd as long,byval hrgn as long,byval bredraw as boolean as long private declare function creat...

vb窗體程式設計例項

使用者密碼驗證登入,按鍵識別。窗體1 兩個標籤,兩個文字框,兩個按鈕。窗體2 乙個文字框 窗體1 視窗名稱form1,標籤1,2分別為lbl1,lbl2,確定,取消按鈕為,cmd1,cmd2,使用者名稱文字框和密碼文字框為txt1,txt2 private sub cmd1 click 確定按鈕滑鼠...