Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

InputBox using WinAPI

0.00/5 (No votes)
12 Jun 2002 1  
InputBox using WinAPI.

Sample Image - InputBox.jpg

Introduction

Do you know VB's InputBox? Me too. =)

So, this class is for those people who need VB-like InputBox in VC++.

Usage

The usage of this class is very easy:

Add InputBox.h and InputBox.cpp into your project, include InputBox.h to the file where you suppose to use Inputbox and:

#include "InputBox.h"


...

CInputBox ibox(hWndParent);
if (ibox.DoModal("Caption", "Prompt")) 
  MessageBox(NULL, ibox.Text, "Title", MB_OK);

In the constructor, you have to provide a valid hwnd of the parent window. Function DoModal(...) returns TRUE if button OK is pressed and FALSE if button Cancel.

CInputBox doesn't need resource file. You can use it with MFC or without one.

That's all.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here