w1z44rdy

Goodday,

I'm having some trouble finding some functionality of .NET lately.

This is what I'm looking for:

A method to send any mouse - 'event' through the active form on a *specific* location;

A method to capture an Image of the desktop/workarea through the active form.

This is what I've found already:

How to click through a form. (not on a specific location) To reveil this a bit: if my mousepos is 333,666 then I can click at 333,666 through the active form; If my mousepos is 333,666 I can't click at 666,999 through the active form. There should be something like: Mouse.MouseUp(x,y, (some par to ignore active form)); <- which doesn't exist, really.

How to capture desktop. With winAPI or .NET lib. Not how to capture desktop without a specific form.

I know these are very specific questions, and might be hard and confusing to understand. I do hope anyway that anyone has any expeirence with these subjects. Any comment in this direction should be usefull. Even if you think it's not 100% related.

Thanks in advance,

w1z44rdy



Re: .NET Base Class Library Desktop click - and captureability.

nobugz

There are lots of ways to generate mouse click events. The most general one is P/Invoking the SendInput() API function. Visit www.pinvoke.net for the declarations. Use Graphics.CopyFromScreen() to capture the desktop.





Re: .NET Base Class Library Desktop click - and captureability.

w1z44rdy

I'm looking into that website for mouse click events. Thanks for that.

About that dekstop capture.. Didn't I mention I needed a specific capture Not just the whole CopeFromScreen! Anyway, I'll take a look into that website for that issue aswell.

Thanks




Re: .NET Base Class Library Desktop click - and captureability.

w1z44rdy

BTW:

Issues aren't solved yet. Please keep posting your suggestions! Thanks




Re: .NET Base Class Library Desktop click - and captureability.

nobugz

That's what the Point and Size arguments are for. Use the MSDN library for details.





Re: .NET Base Class Library Desktop click - and captureability.

w1z44rdy

That method doesn't allow such advanced features (such as ignoring some windows) that I need.

Anyway.. About that mouseclick. I've been looking through your suggested webpage and it's not helping me very well. (maybe it's just the lack of knowledge about windows api) Anyway, shouldn't there be such a thing to send a click (on a specific location) to a specific window/control (like 0 for desktop)




Re: .NET Base Class Library Desktop click - and captureability.

nobugz

If you have the handle of a specific window that should see the click, use SendMessage() and send the WM_LBUTTONDOWN and WM_LBUTTONUP messages.





Re: .NET Base Class Library Desktop click - and captureability.

w1z44rdy

Thanks for that information.

I' was wondering if this could this be done:
create new desktop;
keep track of default desktop and send images to the other desktop;
send clicks invoked on the other desktop to the default one;

You did say I can send mouseclicks to windowhandles but I'm not sure if that includes desktop handles. (I'm told default desktop has handle 0 Then what would be the handle of the 'other' desktop )