Solved

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

Posted on 2006-07-15
7
219 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 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 86

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
Technology Partners: 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

733 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