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

  • On-demand Event Event Date: December 18, 2014 The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this webcast and join industry experts as …

  • On-demand Event Event Date: October 29, 2014 It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this webcast, Gene Kim discusses these survey findings and shares woeful tales of artifact management gone wrong! Gene also shares examples of how high-performing DevOps …

Most Popular Programming Stories

More for Developers

RSS Feeds