Click here to Skip to main content
15,885,216 members
Articles / Desktop Programming / MFC
Article

InputBox using WinAPI

Rate me:
Please Sign up or sign in to vote.
4.63/5 (16 votes)
12 Jun 2002 141K   3K   30   20
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


Written By
mah
Web Developer
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionErrors... Pin
Member 123800679-Mar-16 1:37
Member 123800679-Mar-16 1:37 
GeneralMy vote of 5 Pin
kod121-Mar-12 23:36
kod121-Mar-12 23:36 
GeneralMy vote of 5 Pin
Sunny12708-Jan-12 2:57
Sunny12708-Jan-12 2:57 
GeneralThou Shalt Not ... Pin
DogWalker13-Sep-03 20:11
DogWalker13-Sep-03 20:11 
GeneralAnother bug: GetClassInfoEx() Pin
Michael Geary4-Sep-03 19:28
Michael Geary4-Sep-03 19:28 
GeneralGreat! But... Pin
Hofver18-Dec-02 23:37
Hofver18-Dec-02 23:37 
GeneralRe: Great! But... Pin
mah18-Dec-02 23:49
mah18-Dec-02 23:49 
GeneralGreat Pin
Ancient Dragon14-Jun-02 2:05
Ancient Dragon14-Jun-02 2:05 
GeneralHehe Pin
Nish Nishant13-Jun-02 0:12
sitebuilderNish Nishant13-Jun-02 0:12 
GeneralRe: Hehe Pin
mah13-Jun-02 0:38
mah13-Jun-02 0:38 
GeneralRe: Hehe Pin
Nish Nishant13-Jun-02 1:08
sitebuilderNish Nishant13-Jun-02 1:08 
GeneralRe: Hehe Pin
mah13-Jun-02 1:26
mah13-Jun-02 1:26 
GeneralRe: Hehe Pin
13-Jun-02 6:51
suss13-Jun-02 6:51 
GeneralRe: Hehe Pin
Nish Nishant13-Jun-02 14:07
sitebuilderNish Nishant13-Jun-02 14:07 
GeneralRe: Hehe Pin
Andrew Peace11-Jul-02 12:55
Andrew Peace11-Jul-02 12:55 
GeneralRe: Hehe Pin
Nish Nishant11-Jul-02 14:45
sitebuilderNish Nishant11-Jul-02 14:45 
GeneralRe: Hehe Pin
Andrew Peace12-Jul-02 7:08
Andrew Peace12-Jul-02 7:08 
GeneralRe: Hehe Pin
Nish Nishant12-Jul-02 14:08
sitebuilderNish Nishant12-Jul-02 14:08 
GeneralRe: Hehe Pin
Tim Smith11-Jul-02 14:26
Tim Smith11-Jul-02 14:26 
GeneralRe: Hehe Pin
Nish Nishant11-Jul-02 14:46
sitebuilderNish Nishant11-Jul-02 14:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.