none
control app with MS office like ribbon interface RRS feed

  • Question

  • Probably a generic question but I find that spy++ will not identify the button which is part of a "Ribbon" menu interface.

    Without the control-ID of the button, I cannot get my CCF adapter to click on the button. Any help?

     

    Thanks

    Thursday, May 15, 2008 1:30 AM

All replies

  • JUST Identify its position by scaning the application you can use this code :

    private int x;

    private int y;

    private IntPtr iptrEditWin;

    private IntPtr iptrApp;

    private System.Drawing.Point ScreenPoint;

    protected int ScreenWidth;

    protected int ScreenHight;

    Win32API.RECT rec = new Win32API.RECT();

    Process theprocess = Process.GetProcessesByName("ProcessName");

    Win32API.GetWindowRect(theprocess.MainWindowHandle, ref rec);

    iptrApp = theprocess.MainWindowHandle;

    ScreenWidth = rec.right - rec.left;

    ScreenHight = rec.bottom - rec.top;

    ScreenPoint = new System.Drawing.Point(0, 0);

    iptrEditWin = System.IntPtr.Zero;

    for (y = 0; y < ScreenHight; y++)

    {

    for (x = 0; x < ScreenWidth; x++)

    {

    ScreenPoint.X = x;

    ScreenPoint.Y = y;

    iptrEditWin = System.IntPtr.Zero;

    iptrEditWin = Win32API.FindWindowByPosition(iptrApp, ScreenPoint);

    if (iptrEditWin != System.IntPtr.Zero)

    {

    //\ WE Find A Control

    MissageBox.Show("X= "+ScreenPoint.X.ToString() + " Y= " +ScreenPoint.Y.ToString())

    }

    }

    Sunday, May 18, 2008 12:48 PM