Help with dialog focus

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spur
    New Member
    • Nov 2006
    • 1

    Help with dialog focus

    Hi,

    Ok I got 2 programs > Server > Client/Remote

    When I first run the server it will check for remote sites which have ip/rs232 devices listening, that are configured in the server database. for each entry in the site database it opens 1 dialog box per connection, with info about each connection. Also Remote client programs that are running at the time will attempt to connect, which could be any amount, and at anytime. Which also brings up dialogs. During start up, however on the server side. If you want to be able to edit any configurations you will need to login. The problem is when the program is making new client connections and you're trying to type in your id/password, it sets focus to the new boxes that come up, as they come up, even if the connection dialogs are optionally set to hidden. Im wondering if there is a way I can force the focus on the login box, until you have logged in. Currently have the connection box and the login box are forced to Always on top, so even if you minimize the program you can still monitor the connections. The reason these connections need to be made before logging in, is because it is an automated system, and must restart incase of a power failure.

    Any help would be appreicated.
    Thanks :)
  • sivadhas2006
    New Member
    • Nov 2006
    • 142

    #2
    Hi,

    To set the focus to the control you can use
    Code:
    SetFocus(HANDLE_OF_THE_CONTROL_WINDOW)
    To set the focus to the dialog you want to use
    Code:
    SetForegroundWindow(HANDLE_OF_THE_DIALOG_WINDOW)
    Regards,
    M.Sivadhas.

    Comment

    Working...