Solved

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

Posted on 2006-07-15
7
215 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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 …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

22 Experts available now in Live!

Get 1:1 Help Now