winzip icon

Subclassing Thunk (VB+ASM = Office XP Menus :-)) w/ Sample HookMenu 1.4

Submitted on: 1/29/2015 3:18:00 AM
By: Vlad Vissoultchev (from psc cd)  
Level: Advanced
User Rating: By 146 Users
Compatibility: VB 6.0
Views: 14111
     UPDATE(2002-12-13): Sample HookMenu 1.4 introduces RightToLeft forms support. __________________________________________________ UPDATE(2002-11-27): Sample HookMenu 1.3.5 fixes problems with MDI forms. Separators are reduced to 3 pixels to match Office XP ones. You can use DontHookMenu=1 when debugging and the control is part of your project. __________________________________________________ UPDATE(2002-11-23): Sample HookMenu 1.3.4 fixes troubles in NT 4.0, menubar background color in Win XP classic appearance and sub-menu arrow forecolor if menu text is not black. __________________________________________________ UPDATE(2002-11-21): Sample HookMenu 1.3.3 fixes an XP redraw bug, an accelerator (underlined) symbols bug and keyboard navigation in Win9x. Sample HookMenu 1.3.2 adds custom drawing of sub-menus arrows and fixes unicode strings support. Various fixes for Win95 support. __________________________________________________ UPDATE(2002-11-20): Sample HookMenu 1.3.1 fixes issues with WindowList menus and 3rd level sub-menus positioning. __________________________________________________ UPDATE(2002-11-18): Sample HookMenu 1.3 fixes issues with the subclasser (both in Win 9x and NT/2K/XP) so no more GPFs. Closer Office XP experience: menu colors are closer to Office values in 8bit color depth and in high contrast color scheme; menu shadow simplified as in Office in 8bit color depth; popup menus are positioned manually two pixels down; seamless shadow if popup is above the menubar. __________________________________________________ UPDATE(2002-11-12): Sample HookMenu 1.2 fixes the issue with TextBox popup menus (finally!). Some design time issues and menubar background color problems spotted by Ovidiu Boldea. Also, the property page is working more fluently now. I'm sick of win9x and so these are not supported from now on (ok, promise to do my best:-)). __________________________________________________ UPDATE(2002-11-10): Sample HookMenu 1.1 fixes issues in NT 4.0 and MDI child forms. Can anyone test the control under win95? __________________________________________________ This is a second attempt on moduleless window subclasser featuring "run-time dynamically generated machine code". The original was submitted by Paul Caton a couple of months ago. The present version is safer and is based on a completely rewritten assembly thunk. Also I have changed the name of the subclasser to reflect more closely what in fact it's doing. In addition to this you get the hooking thunk which (you guessed it) hooks windows hooks in a convenient and safe way. Both of the thunks' source files (assembly) are included. Both thunks are designed to be and have shown to be exceptionally safe in the IDE, they seem immune to both the end button and End statement - try to crash them and let me know what your results are. The screenshot is from a sample project (included in the zip) which subclasses a form's menus and turns them into Office XP clones - now it's not necessary to include 13000 lines of "supercode" to get the Office XP style menus under win 98/2000/XP/.Net Server (not tested on 95/NT btw). Enjoy and leave your votes!

winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net

Other 12 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

7/28/2015 10:32:37 AMhai2hai

This component can't run in Windows Server 2008 R2 and Windows Server 2012. Anyone know how to fix?
(If this comment was disrespectful, please report it.)


Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.