Thread: Accessing External App's Control Property

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    4

    Accessing External App's Control Property

    If I create a form with a .net control, lets say a button, and I set the enable property of this button to false, it is possible for an external process to change the enable property to true at runtime? I assume that the answer is definitely yes, since it'll just be some binary value in memory, but is there an API or an easy way to accomplish this?

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Yes there is, I *think* you can do it with EnableWindow()

    eg:
    Code:
    /* use FindWindow to get the dialogs hwnd = hWnd */
    /* use spy++ or whatever to get the id of the button = id */
    
    EnableWindow(GetDlgItem(hWnd, id), TRUE);       /* enable it */
    I don't know if EnableWindow() has to be in the same thread as the window, probably not see MSDN.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    4
    Hmm, interesting, thanks for the response. That did change some property of the control, but not in the way I wanted. If the .net button is disabled, and you call EnableWindow(*blah*, true) you can now click the button and it becomes active, but the text is still gray and the click event of the button is not fired. EnableWindow appears to be talking about a different kind of enabled/disabled than the .net control understands.

    Thanks for the help so far. Anyone have any more ideas?

    Just as an aside to show that it did actually do something; if the .net control is enabled and you do EnableWindow(*blah*, false) the text remains black but the click event no longer fires.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  4. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 03:01 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM