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)



Comments

  • CustomizedInputBox

    Posted by Legacy on 07/31/2003 12:00am

    Originally posted by: subas sahoo

    Very Good,
    but serching for more customized.

    Reply
  • InputBox

    Posted by Legacy on 07/06/2003 12:00am

    Originally posted by: Richard

    how do I create an InputMask for the InputBox, lets say I want to add the 'Password' mask to display stars??
    

    Reply
  • Good but what about setting the Max length

    Posted by Legacy on 07/31/2002 12:00am

    Originally posted by: Brad

    The max length of the input Box is 256 characters. How about a way to set it to say 20 characters similar to the textbox maxlengh property.

    Reply
  • This is good BUT.....

    Posted by Legacy on 05/18/2002 12:00am

    Originally posted by: sunny

    This program is good but i was thinking if you can reduce its size....
    
    

    Reply
  • I was searching for Small Size Input Box

    Posted by Legacy on 09/15/2000 12:00am

    Originally posted by: J. R. Poudel

    i appericiate your work,but you have not tried to make the size of Input Box Small.
    If you get any Idea to make small size input box please inform me

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: August 19, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT You deployed your app with the Bluemix PaaS and it's gaining some serious traction, so it's time to make some tweaks. Did you design your application in a way that it can scale in the cloud? Were you even thinking about the cloud when you built the app? If not, chances are your app is going to break. Check out this upcoming webcast to learn various techniques for designing applications that will scale successfully in Bluemix, for the …

  • Live Event Date: September 19, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT In response to the rising number of data breaches and the regulatory and legal impact that can occur as a result of these incidents, leading analysts at Forrester Research have developed five important design principles that will help security professionals reduce their attack surface and mitigate vulnerabilities. Check out this upcoming eSeminar and join Chris Sherman of Forrester Research to learn how to deal with the influx of new device …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds