Jump to content
Xtreme .Net Talk

gtzpower

Members
  • Posts

    12
  • Joined

  • Last visited

gtzpower's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Here's my source code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Runtime.InteropServices; using System.Text; using Accessibility; namespace AccessibilityApp { /// <summary> /// Summary description for WinForm. /// </summary> public class WinForm : System.Windows.Forms.Form { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; private System.Windows.Forms.Button testButton; (System.Object childID); public WinForm() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose (bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.testButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // testButton // this.testButton.Location = new System.Drawing.Point(56, 32); this.testButton.Name = "testButton"; this.testButton.Size = new System.Drawing.Size(176, 64); this.testButton.TabIndex = 0; this.testButton.Text = "Test"; this.testButton.Click += new System.EventHandler(this.testButton_Click); // // WinForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 273); this.Controls.Add(this.testButton); this.Name = "WinForm"; this.Text = "WinForm"; this.ResumeLayout(false); } #endregion ///Declare APS's and Constants delegate bool EnumWindowsCallback(IntPtr hWnd, int lParam); [DllImport("user32.dll")] static extern int EnumWindows(EnumWindowsCallback callback, int lParam); delegate bool EnumChildWindowsCallback(IntPtr hWnd, int lParam); [DllImport("user32.dll")] static extern int EnumChildWindows(IntPtr hWnd, EnumChildWindowsCallback callback, int lParam); [DllImport("user32.dll")] public static extern void GetWindowText(IntPtr hWnd, System.Text.StringBuilder lpWndTxt, int nMaxCount); [DllImport("oleacc.dll",CharSet=CharSet.Auto)] public static extern IntPtr AccessibleObjectFromWindow (IntPtr hwnd, uint dwId, UUID riid, out IAccessible ppvObject); IntPtr notepadWindow; /// <summary> /// The main entry point for the application. /// </summary> [sTAThread] static void Main() { Application.Run(new WinForm()); } private void testButton_Click(object sender, System.EventArgs e) { EnumWindows(new EnumWindowsCallback(checkHWND), 0); if(notepadWindow.ToInt32() != 0) EnumChildWindows(notepadWindow, new EnumChildWindowsCallback(findChildWin),0); } private bool checkHWND(IntPtr hWnd, int lParam) { int n = 18; System.Text.StringBuilder wndText = new System.Text.StringBuilder(n); GetWindowText(hWnd, wndText,n + 1); if(wndText.ToString() == "Untitled - Notepad") notepadWindow = hWnd; return true; } private bool findChildWin(IntPtr hWnd, int lParam) { UUID uuidAccessible = new UUID(); uuidAccessible.data1 = 0x618736e0; uuidAccessible.data2 = 0x3c3d; uuidAccessible.data3 = 0x11cf; uuidAccessible.data4 = new byte[8]; uuidAccessible.data4[0] = 0x81; uuidAccessible.data4[1] = 0xc; uuidAccessible.data4[2] = 0x0; uuidAccessible.data4[3] = 0xaa; uuidAccessible.data4[4] = 0x0; uuidAccessible.data4[5] = 0x38; uuidAccessible.data4[6] = 0x9b; uuidAccessible.data4[7] = 0x71; IAccessible accObj; AccessibleObjectFromWindow(hWnd,0x00000000,uuidAccessible,out accObj); MessageBox.Show(accObj.ToString()); accObj.accValue = "5"; testButton.Text = Accessibility.IAccessible.get_accValue(System.Object ); return true; } } } [structLayout(LayoutKind.Sequential)] public class UUID { public int data1; public short data2; public short data3; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]public byte[] data4; } These 2 lines are causing problems compiling: accObj.accValue = "5"; testButton.Text = Accessibility.IAccessible.get_accValue(0); The first line says that the property is not supported be the language, and recommends using the Accessibility.IAccessible.get_accValue(object);. The second says that an object reference is required for the non-static method. On this site (in the private methods section): http://www.dotnet247.com/247reference/System/Windows/Forms/AccessibleObject/__members I can use any of the methods or access them as properties of accObj as long as they don't have anything in the ()'s as they appear on the site (the object reference???) like accObj.getChildCount works fine and returns a numerical value. Maybe this is a lead to fixing my problem? Please help!
  2. I am coding in c# and I can not get the AccessibleObjectFromWindow API to work (and provide a useable object) for the life of me. You know you're in trouble when you search google, and EVERY result is purple instead of blue (indicating you have clicked them already) I have tried sooooooooooooooo many different snippets of code and I am not having any luck. Please help if you can! I'll even PayPal ya $5 (maybe more) if you can help me get it working! TIA
  3. I am 100% lost. My compiler does not recognize "IAccessible" at all, and i seem to be having a hard time finding any further information on it.
  4. That was actually a lot of help. I got the MSAA Explorer from microsoft.com, and it found the address bar, along with MANY other things that SPY++ did not. I am not at home right now to play with it further, but does anyone know of any tutorials for using the MSAA SDK? Thanks again HJB417.
  5. Anyone??? :confused: :o :(
  6. If i understand you properly, i think you will need to get an IDE like Visual Basic .NET or Borland C# Builder, etc...
  7. Hmm, in IE, i would enumchild windows after getting the main hWnd for IE, then use the sendmessage API to set the text of the address bar. In mozilla though, i can't seem to get an hWnd for the address bar. Not even SPY++ or WinSpy can lock on it. Anyone know how i could accomplish setting the address in mozilla? I will also need to be able to get the current address as well. thanks
  8. looking through the fonts, a lot of them are even off centered vertically
  9. Hey, thanks. I tried aerial last night, and it did the same thing, so i didn't think it was the font, but Courier works nicely. Is there a fix? I like the ms font, but alas, i am not totally held down to using "System" style buttons.
  10. I don't think so. "Standard" is also 3D, but that is off centered too. Here's a quick example i whipped up:crap.bmp
  11. Strange problem here. If i create a button (in C# or VB) the text won't TRUELY center unless the "flatStyle" property is set to "System" for that button. Does anyone know why this is? It only seems to do this when the text is so long (for example "Change Account Number"). Try it in your IDE, i am sure it will happen. This doesn't seem promising for a newbie to .net.
×
×
  • Create New...