Solved

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

Posted on 2006-07-15
7
217 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

786 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