VBcoders Guest

Don't have an account yet? Register

Forgot Password?

Autohighlight active control (SDI/1 Form)

by Marcel A. Fritsch (3 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

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.

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!!!

Rate Autohighlight active control (SDI/1 Form)

Download Autohighlight active control (SDI/1 Form)

Download Autohighlight active control (SDI/1 Form) (3 KB)

Autohighlight active control (SDI/1 Form) Comments

No comments have been posted about Autohighlight active control (SDI/1 Form). Why not be the first to post a comment about Autohighlight active control (SDI/1 Form).

Post your comment

0/1000 characters