程序中的事件处理 [英] Event handling in a program

查看:71
本文介绍了程序中的事件处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须执行一个do..while()循环才能在我的应用程序中发出声音.我想在声音后显示一条消息.因此,我将声音编码在do循环中.在while()中,条件将是事件处理方法.如果事件已处理,则消息框将不显示.我怎样才能做到这一点.请帮忙

谢谢

I''ve to execute a do..while() loop to make a sound in my application. I want to show a message after the sound. So I coded the sound in the do loop. In the while() the condition will be the event handling method. If event handled the message box will be shown otherwise not. How can I do this. Please help

Thanks

推荐答案

如果我正确理解了您,那么您想播放声音并在方法正确处理过程时显示一条消息.为此,我将使用一个简单的if构造,就像这样

If I get you correctly, then you want to play a sound and show a message if a method handles a procedure correctly. For this I would use a simple if construct, something like this

void MainMethod()
       {
           if (EventHandlingMethod())
           {
               //play sound
               //show message
           }
       }

       bool EventHandlingMethod()
       {
           //Handle method here
           //If success return true
           //else return false
       }



希望对您有帮助



Hope this helps


这篇关于程序中的事件处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆