Send Message ENTER to a Dialog

Posted on 2005-04-25
Last Modified: 2008-05-09
Hi Experts

My machine uses WinXP. I have a dialog 'About' with a button 'OK' show on the sceen. I want to program a app (C#) send a message ENTER to this dialog to Close the dialog
How to do this?

Question by:vinhnl
    LVL 2

    Accepted Solution


    in the System.Windows.Forms namespace there is a class called SendKeys

    so you can say


    and it emulates enter. If you include that in a timer or a function thats called on your wanted event you can send that.
    The documentation for the class.

    mfg maZe
    LVL 8

    Author Comment

    But the dialog isn't in the application
    LVL 2

    Expert Comment

    that doesnt matter...

    thats a global keyboard hook... you can use it everywhere... it just emulate a key press in the active window your working in...

    mfg WebSpecials
    LVL 8

    Author Comment

    yes. but maybe this form isn't active.
    LVL 8

    Author Comment

    thanks WebSpecials. You are correct!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now