Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

MS Paint color palette problem

$
0
0

How could I select a color in color palette with other application?

I have used UI automation, but it did not work. The ClassName of the color palette was blank, and its ControlType was "ControlType.Custom" using UI spy. 

Then, I have tried to send message to window handle (NetUIHWND).

    SendMessage(NetUIHWND, WM_LBUTTONDOWN, IntPtr.Zero, point);

    SendMessage(NetUIHWND, WM_LBUTTONUP, IntPtr.Zero, point);

Buttons, such as pencil and eraser, could be selected. However, it still could not select a color in color palette. 

    SendMessage(NetUIHWND, WM_RBUTTONDOWN, IntPtr.Zero, point);

    SendMessage(NetUIHWND, WM_RBUTTONUP, IntPtr.Zero, point);

When I tried to send right mouse down and up message to the window handle, it acted well.

I also tried SetCursorPos and mouse_event function. However, it did not work when the ms paint was blocked by other applications.



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>