好文档 - 专业文书写作范文服务资料分享网站

VB制作随机点名程序源码

天下 分享 时间: 加入收藏 我要投稿 点赞

VB制作幻灯片随机点名工具

大家好,我是丶灬尛坏坏"

注:此程序适用于 学校班级 实用,

此文是原创,转载请标明出处,

本次教程:这个在powerpoint里,完全和powerpoint结合起来,我简单写了

一下,新建一个vb程序,在窗体上放一个label,一个timer和一个按钮,timer的interval设置为1,Enable设置为False。

源码(不解释,自己研究):

Dim a(0 To 9) As String Private Sub Command1_Click()

Timer1.Enabled = Not Timer1.Enabled End Sub

Private Sub Form_Load()

SetHotkey Me.hwnd, 1, 0, vbKeyHome, \ a(0) = \张三\ a(1) = \李四\ a(2) = \王五\ a(3) = \刘六\ a(4) = \牛七\ a(5) = \马八\ a(6) = \杨九\ a(7) = \苟十\ a(8) = \朱十一\

a(9) = \吕十二\ End Sub

Private Sub Form_Unload(Cancel As Integer) SetHotkey Me.hwnd, 1, 0, 0, \ End Sub

Private Sub Timer1_Timer() Dim i As Integer i = Int(Rnd * 10) Label1.Caption = a(i) Label1.Tag = i End Sub

新建一个模块,写入以下代码

Private Declare Function SetWindowLong Lib \As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Declare Function GetWindowLong Lib \As Long, ByVal nIndex As Long) As Long

Private Declare Function CallWindowProc Lib \lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Declare Function RegisterHotKey Lib \ByVal fskey_Modifiers As Long, ByVal vk As Long) As Long

Private Declare Function UnregisterHotKey Lib \Long) As Long

Public Declare Function ShowWindow Lib \As Long) As Long

Public Declare Sub keybd_event Lib \dwFlags As Long, ByVal dwExtraInfo As Long)

Public Declare Function SendMessage Lib \Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Public Declare Function SetForegroundWindow Lib \

Const SW_HIDE = 0 Const SW_SHOW = 5 Const WM_HOTKEY = &H312 Const MOD_ALT = &H1 Const MOD_CONTROL = &H2 Const MOD_SHIFT = &H4

Const GWL_WNDPROC = (-4) '窗口函数的地址 Dim FormIsShowing As Boolean

Dim key_preWinProc As Long '用来保存窗口信息

Dim key_IsWinAddress As Boolean '是否取得窗口信息的判断

Function keyWndproc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long If Msg = WM_HOTKEY Then

Select Case wParam 'wParam 值就是 key_idHotKey

Case 1 '激活 多 个热键后,多 个热键所对应的操作,大家在其他的程序中,只要修改此处就可以了

VB制作随机点名程序源码

VB制作幻灯片随机点名工具大家好,我是丶灬尛坏坏"注:此程序适用于学校班级实用,此文是原创,转载请标明出处,本次教程:这个在powerpoint里,完全和powerpoint结合起来,我简单写了一下,新建一个vb程序,在窗体上放一个label,一个timer和一个按钮,timer的inter
推荐度:
点击下载文档文档为doc格式
3iqxc77d5d4ncj33s2bw8iiwn479cv018dv
领取福利

微信扫码领取福利

微信扫码分享