Note to Developers - Frustration with thread isolation restrictions

****Sigh****

I've had this favorite old vb6 program. It gets pixels off the whole screen I do a getpixel for the color information. It's timer driven sampling at 100ms intervals. I converted it to .dot net but notice that old API calls were not working. That wasn't because of marshalling. When I looked up the documentation (GetAsyncKey is an example, I noticed that these routines will return a zero if they are not called by the thread that started the form.

I can't do subclassing because I'm interested in pixels off the form.

I get so frustrated at the restrictions on multithreading. There really should be some way to turn that off. I also understand that this may be a security concern because someone could be reading the keyboard, unbeknownst to them.

All I know, is that i'd love to be able to take responsibility for my own multiple threads like I used to do in vb6. I LOVE VS2005, it's a work of art but this one thing is so troubling.

At this point, I don't see a way to get the pixel data and look at keyboad commands which would start different modes of operation.

[1099 byte] By [ReneeC] at [2007-12-17]
# 1
Just out of curiosity, what documentation are you referring to? The Win32 API behaves slightly differently depending on what version of Windows you are running, but as you say, that is more a security feature and not a traditional threading issue...

I believe that you should be able to use the function if you have the appropriate access permissions on the current desktop (but I haven't tried this myself, so I'm not 100% sure of this). Could you try opening the current input desktop with generic read & record journal priveleges and see if that succeeds?

Best regards,
Johan Stenberg

JohanStenberg at 2007-9-8 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2
Hi Johan, :)

I'm referring to the MSDN documentation on GetAsynchKeystate.

It appeared to be up to date info and it specifically included XP.

I only use one decktop and this is a form application, not a console task. I run with full administrative privileges.

I'm running this program and desktop with the same privileges and configuration that I always have. I've also checked the arguments very closely.

ReneeC at 2007-9-8 > top of Msdn Tech,Visual Basic,Visual Basic General...