How to find out if a check box is checked...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amitjul
    New Member
    • Apr 2007
    • 5

    #16
    Hi Guys, does anyone knows how to fire any keys. I mean if i want to press ESC key to unload one particular dialog/form How to send message using API in C# ??

    Originally posted by amitjul
    I am trying to get the state of checkbox/radiobutton/button from a C# application to C# application. so both are different application and both are mine. :)


    Where is the T-shirt ?? :)

    Comment

    • amitjul
      New Member
      • Apr 2007
      • 5

      #17
      No one knows ???? :(
      Originally posted by amitjul
      Hi Guys, does anyone knows how to fire any keys. I mean if i want to press ESC key to unload one particular dialog/form How to send message using API in C# ??

      Comment

      • tbarto
        New Member
        • Feb 2007
        • 19

        #18
        Originally posted by amitjul
        No one knows ???? :(
        Hi Amitjul

        Here is probably a solution You've been looking for. You may use:

        System.Windows. Forms.SendKeys. SendWait(keys);

        method in the follwing way:

        Code:
        		
        
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        private static extern bool SetForegroundWindow(IntPtr hWnd);
        
        
        IntPtr _handle;  //handle to the destination control
        
        public void SendKeys(string keys, int delay) {
        			
        
        if(!(SetForegroundWindow(_handle)))
        	throw new ExternalException("SetForegroundWindow failed");
        
        System.Windows.Forms.SendKeys.SendWait(keys);
        Thread.Sleep(delay);			
        }
        More info about the keys that can be sent to an active control and about SendKeys.SendWa it(keys) method You will find here:

        Comment

        • tbarto
          New Member
          • Feb 2007
          • 19

          #19
          Originally posted by amitjul
          Hi Guys,
          That Guid is the constant which you can't change (i dont know the reason :) ). and AccessibleObjec tFromWindow is working with preety weird way. i tried to decode it but i failed. ne way, i just found a good solution.

          IAccessible accObj = (IAccessible)Ac cessibleObjectF romWindow(hwnd, OBJID_WINDOW,
          ref uid);

          In above code, instead of passing OBJID_WINDOW , try with OBJID_CLIENT

          accObj.get_accS tate(0) will return you some integer value like as below:

          public const long UNCHECKED = 1048576;
          public const long CHECKED = 1048592;
          public const long UNCHECKED_FOCUS ED = 1048580; // if control is focused
          public const long CHECKED_FOCUSED = 1048596; // if control is focused


          so based on that you can easily distiguish that which one is checked (checkbox/radionbutton). Its weird but deadlines are there so.... :)
          Hi

          When running the code i get 0 when a checkbox is unchecked and 16 when it is checked. The values are not exactly the same as in Your code, however I am able to determine if a checkbox is checked or not.

          Thanks a lot!!!

          Comment

          • tbarto
            New Member
            • Feb 2007
            • 19

            #20
            Originally posted by tbarto
            Hi

            When running the code i get 0 when a checkbox is unchecked and 16 when it is checked. The values are not exactly the same as in Your code, however I am able to determine if a checkbox is checked or not.

            Thanks a lot!!!
            Sorry,

            My fault. Amitjul - everything works exactly as in Your code.

            Thanks

            Comment

            • tbarto
              New Member
              • Feb 2007
              • 19

              #21
              PropertyGrid

              I was just wondering. Perhaps any of You Guys knows a way to get access to the PropertyGrid component? The problem is that I am unable to find an info about that. E.g:



              Under the link above there is an info about many UI components, unfortunately nothing about PropertyGrid :-(

              Comment

              • tbarto
                New Member
                • Feb 2007
                • 19

                #22
                I have found some differences in types on object returend by AccessibleObjec tFromWindow. What I mean is that when working on Win XP, the type of the object is System._ComObje ct , but as I tried on Win 2000 the type was System.Runtime. Remoting.Proxie s._TransparentP roxy . Obviously, I was unable to cast that type to IAccessible, which caused an exception. Does anybody have any idea about those differences?

                Thanks

                Comment

                • vCracker
                  New Member
                  • Mar 2008
                  • 1

                  #23
                  Hello guys,
                  I'm working in .net C# to get the URL from IE and Firefox. The IE part was over and I'm stuck up at firefox.
                  I can't drill down to its address bar(combobox) to get its value. So can anybody help me this problem.
                  I've gone through your above discussion but not getting what I want.
                  Ive used accExplorer 2.0 to see the hierarchy of the firefox, and I can see the address bar there but problem is how to access it.

                  Comment

                  Working...