Results 1 to 10 of 10

Thread: Detect if Window or Control is Enabled

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    400

    Detect if Window or Control is Enabled

    Is there a code that checks if a window or control is enabled or disabled?

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Detect if Window or Control is Enabled

    not really. if you check to see if it's enabled, it will be loaded. it's better to have a flag to show the state for use in another procedure.

  3. #3
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Detect if Window or Control is Enabled

    Like check its Enabled Property?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Detect if Window or Control is Enabled

    Checking the property will load and enable it.

  5. #5
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Detect if Window or Control is Enabled

    Command2 returned false...

    VB Code:
    1. Private Sub Command1_Click()
    2.     frmCancelReason.Enabled = False
    3. End Sub
    4.  
    5. Private Sub Command2_Click()
    6.     MsgBox frmCancelReason.Enabled
    7. End Sub
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    400

    Re: Detect if Window or Control is Enabled

    I'm talking about checking if a window or control in another program is enabled.

  7. #7
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Detect if Window or Control is Enabled

    Don't get what you mean but you can cycle through the Screen.ActiveControl method to find what controls are enabled or look through the Controls Collection and the Forms Collection to see what is loaded.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    400

    Re: Detect if Window or Control is Enabled

    Never mind. I found the IsWindowEnabled and IsWindowVisible APIs.
    Last edited by abazabam; Dec 15th, 2005 at 09:22 PM.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Detect if Window or Control is Enabled

    Quote Originally Posted by abazabam
    Never mind. I found the IsWindowEnabled and IsWindowVisible APIs.
    This would give you information on the Window itself, not the controls within the window.

  10. #10
    New Member
    Join Date
    Jun 2010
    Posts
    1

    Re: Detect if Window or Control is Enabled

    Quote Originally Posted by Hack View Post
    This would give you information on the Window itself, not the controls within the window.
    It is quite possible.

    You have to find the the handle of child control using FindWindowEx.

    After you get the handle you just have to pass the handle to this function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width