如何实现程序暂停,等待鼠标或键盘输入后进行下一步动作?-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

如何实现程序暂停,等待鼠标或键盘输入后进行下一步动作?

leesharpen 2017-03-11 23:26:52 2390
Func Start()
    $url = "D:\src\test.html"
    $ie = J_IE_Create($url, "", "", "")
    J_Windows($ie, "最大化")
    $htmlContent_1 = '<!DOCTYPE html><html><head><title>Test</title></head><body><div id="Layer1" style="position:absolute;width:100%;height:100%;z-index:-1"><img src="'
    $htmlMid = 'D:\src\images\幻灯片'
    $htmlContent_2 = '.jpg" height="100%" width="100%"/></body></html>'
    $maxSlide = 8
    While 1
        $count = 1
        $htmlContent = $htmlContent_1 & $htmlMid & $count & $htmlContent_2
        J_File_Write($url, $htmlContent, "覆盖")
        J_IE_Link($ie, $url)

        While 1
            If _IsPressed("01") Or _IsPressed("4E") Or _IsPressed("27") Then
                $count = $count + 1
                If $count > $maxSlide Then
                    $count = $maxSlide
                EndIf
                $htmlContent = $htmlContent_1 & $htmlMid & $count & $htmlContent_2
                J_File_Write($url, $htmlContent, "覆盖")
                J_IE_Link($ie, $url)
            ElseIf _IsPressed("50") Or _IsPressed("25") Then
                $count = $count - 1
                If $count = 0 Then
                    $count = 1
                EndIf
                $htmlContent = $htmlContent_1 & $htmlMid & $count & $htmlContent_2
                J_File_Write($url, $htmlContent, "覆盖")
                J_IE_Link($ie, $url)
            ElseIf _IsPressed("1B") Then
                J_Windows($ie, "最小化")
            ElseIf _IsPressed("0D") Then
                J_Windows($ie, "最大化")
            ElseIf _IsPressed("2E") Then
                J_IE_Close($ie)
                Exit
            EndIf
            Sleep(50)
        WEnd
    WEnd
EndFunc   ;==>Start
代码奉上,起因是想用码栈控制IE实现类似PPT播放的功能。

分享到
取消 提交回答
全部回答(0)
云计算
使用钉钉扫一扫加入圈子
+ 订阅

时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

推荐文章