VB工程 百例100 獲取鍵盤型別

2021-08-26 16:44:33 字數 925 閱讀 1749

option explicit

private sub command1_click()

dim k, keytype

k = getkeyboardtype(0)

select case k

case 1

keytype = "ibm pc /xt或相容83鍵鍵盤"

case 2

keytype = "olivetti102鍵鍵盤"

case 3

keytype = "ibm pc /xt或相容84鍵鍵盤"

case 4

keytype = "ibm 增強(101 或102鍵)鍵盤"

case 5

keytype = "nokia1050 鍵盤"

case 6

keytype = "nokia9140 鍵盤"

case 7

keytype = "japanese 鍵盤"

end select

label1.caption = "鍵盤型別是:" & keytype

end sub

option explicit

public declare function getkeyboardtype lib "user32" (byval ntypeflag as long) as long

函式功能:該函式獲取系統當前鍵盤的資訊.  函式原型:int getkeyboardtype(int ntypeflag);  引數說明:  ntypeflag:指定要獲取的鍵盤資訊的型別,該引數可以是下面的值之一:  0:鍵盤的型別;  1:鍵盤的子型別;  2:鍵盤上功能鍵的狀態.  注意事項:函式成功將返回使用者指定要獲取的鍵盤資訊,否則返回零值.鍵盤的型別與原始裝置製造商(oem)有關,使用者還可以從鍵盤的型別獲取鍵盤上功能鍵的個數.  標頭檔案:winuser.h 鏈結庫:user32.h

VB工程 百例64游標位置

option explicit private sub command1 click txt1.text 歡迎來到廊坊師範學院 end sub private sub command2 click txt1.text end sub private sub command3 click endend...

VB工程 百例69 訊息框

option explicit private sub form click dim x as integer x msgbox 你單擊的是窗體,是嗎?35,詢問框 if x 6 then 若們四個box的函式的返回值是6 msgbox 你選擇了 是 按鈕 vbinformation,資訊框 彈出的...

VB工程 百例74 窗體變色

option explicit private sub form mousedown button as integer,shift as integer,x as single,y as single if button 2 then 若單擊滑鼠右鍵 popupmenu mnuformcolor ...