?
Solved

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

Posted on 2006-07-15
7
Medium Priority
?
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 63

Accepted Solution

by:
Fernando Soto earned 1600 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 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 400 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 63

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 63

Expert Comment

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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 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