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

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • Mobile is introducing sweeping changes throughout your workplace. As a senior stakeholder driving mobile initiatives in your organization, you may be lost in a sea of technologies and claims from vendors promising rapid delivery of applications to your employees, customers, and partners. To help explain some of the topics you will need to be aware of, and to separate the must-haves from the nice-to-haves, this reference guide can help you with applying a mobile strategy in the context of application …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds