Search Tools Links Login

Autohighlight active control (SDI/1 Form)

This is a very simple and useful solution to highlight input controls without writting a function for each control. I use the SetWindowsHookEx function to receive all Windows messages in a callback function (in this example WindowProc). The WindowProc function calls the SETKILLFocus function if there is an WM_SETFOCUS or WM_KILLFOCUS message and delivers the
the Handle of the control to the SETKILLFocus function.In this Example the highlighting is done only for textboxes and comboboxes but you can easily change the SETKILLFocus function to process other types of controls.
I think the explanation in the source code should answer all other questions. Please vote, if you think its a good solution.

Original Author: Marcel A. Fritsch

Side Effects

When running this progam in the IDE do not use the STOP-Button to exit the program, because the unhook function will not be executed and the IDE crashes!!!

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 83 times


Visual Basic 6

Posted: 9/3/2020 3:45:00 PM
Size: 4,069 bytes

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.