Search code examples
c#c++wpfwinappdriver

How can I find the code line where is located the code that put a yellow square in a windows control?


I am working with WinAppDrive library https://github.com/microsoft/WinAppDriver. If someone have worked with that library know that it is usefull to capture user actions, generate the code that replicate those same actions and finally implement that code that replicate those actions. I have a problem: I need to get the code line that make to appear a yellow mark in the windows control. My porpuse is change the color and the time to wait to appear the yellow mark. Thanks a lot in advanced.

enter image description here


Solution

  • I searched for "Yellow" in the repository.

    Maybe the result in "Tools/UIRecorder/UIXPathLib/UiTreeWalk.cpp" is what you are looking for?

    void DrawYellowHighlightRect(HDC hdc, RECT rc)
    {
        HBRUSH hBr = SelectBrush(hdc, GetStockBrush(NULL_BRUSH));
    
        int YellowInflat = -2;
        if (rc.bottom - rc.top < 30)
        {
            YellowInflat = 2;
        }
    
        HPEN hpYellow = CreatePen(PS_SOLID, 3, RGB(255, 255, 32));
        hpYellow = SelectPen(hdc, hpYellow);
        InflateRect(&rc, YellowInflat, YellowInflat);
        Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom);
    
        DeletePen(hpYellow);
        SelectBrush(hdc, hBr);
    }
    

    Look at the whole file to check all the source