Customizing the default InputBox Window

This short code sample shows how to subclass the standard VB InputBox function so that you can change the default font and fore/background colors used in the dialogs.

sshot

The program works by capturing the WM_CTLCOLORDLG, WM_CTLCOLORSTATIC, WM_CTLCOLORBTN messages as the dialog is created. A windows font and brush are then created and returned to the standard windows message handler to handle the custom drawing.

The code can be used in your program by simply calling the ‘InputBoxEx’ function inplace of the usual ‘InputBox’ statement (once you’ve subclassed your form of course).

A full sample project is included.

Download Zipped Project File (10k)

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read