开发者社区> 问答> 正文

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

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播放的功能。

展开
收起
leesharpen 2017-03-11 23:26:52 2821 0
0 条回答
写回答
取消 提交回答
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载