Solved

Paul Kimmel's Example Does Not Work for VB.NET (FernandoSoto or others please help!)

Posted on 2006-07-15
7
216 Views
Last Modified: 2010-04-23
FernandoSoto please repost your example to http://www.geocities.com/fsoto_apopka/PublicFiles/ (please?!).  I'm having the same exact issue discussed here: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21474990.html?query=keyboard+hook+vb.net&topics=866.  For some reason I can't get the keyboard hooked in VB.NET 2005 running on Windows XP.  KeyboardCallback never gets called.  Please help!  Thanks!!
0
Comment
Question by:scottmichael2
  • 3
  • 3
7 Comments
 
LVL 1

Author Comment

by:scottmichael2
ID: 17115942
OK, as posted on a previous thread there seems to be an issue with this working in design time in VS 2005.  It worked fine when I just ran the exe.  Has anyone figured out why this is or is there a fix that anyone knows of?  Thanks!
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 400 total points
ID: 17116012
Hi scottmichael2;

I have not found out why but if you compile it under VB .Net 2005 it will not work when executed in the IDE development environment but it will work fine when executing the program from the exe file. There must be a bug in the .Net IDE environment that is causing the problem and I do not know if there is a fix to this.

Fernando
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
ID: 17116122
I've also never found a reason or a fix to allow the hook to work in the VB.Net 2005 IDE...it's just something you have know and deal with...   =(
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:scottmichael2
ID: 17132473
I think this answers the question...

"Important   When Visual Basic is in break mode, you can't call vtable methods or AddressOf functions. As a safety mechanism, Visual Basic simply returns 0 to the caller of an AddressOf function without calling the function. In the case of subclassing, this means that 0 is returned to Windows from the WindowProc. Windows requires nonzero return values from many of its messages, so the constant 0 return may create a deadlock situation between Windows and the Visual Basic, forcing you to end the process."

I got it from here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconpassingfunctionpointerstodllprocedurestypelibraries.asp
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 17132608
Hi scottmichael2;

The article you have the link to is referencing VB 6 and not .Net. I do not think this holds true in .Net seeming that it did work OK in the VB .Net 2003 version.

Fernando
0
 
LVL 1

Author Comment

by:scottmichael2
ID: 17145491
Good point - I guess it's still a mystery then :-)
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 17145600
Yes it looks like it is. ;=)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now