Click here to Skip to main content
14,978,482 members
Articles / Desktop Programming / MFC
Article
Posted 12 Jun 2002

Stats

135.1K views
2.9K downloads
30 bookmarked

InputBox using WinAPI

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

Share

About the Author

mah
Web Developer
Russian Federation Russian Federation
No Biography provided

Comments and Discussions

 
QuestionErrors... Pin
Member 123800679-Mar-16 1:37
MemberMember 123800679-Mar-16 1:37 
GeneralMy vote of 5 Pin
kod121-Mar-12 23:36
Memberkod121-Mar-12 23:36 
GeneralMy vote of 5 Pin
Sunny12708-Jan-12 2:57
MemberSunny12708-Jan-12 2:57 
GeneralThou Shalt Not ... Pin
DogWalker13-Sep-03 20:11
MemberDogWalker13-Sep-03 20:11 
GeneralAnother bug: GetClassInfoEx() Pin
Michael Geary4-Sep-03 19:28
MemberMichael Geary4-Sep-03 19:28 
GeneralGreat! But... Pin
Hofver18-Dec-02 23:37
MemberHofver18-Dec-02 23:37 
GeneralRe: Great! But... Pin
mah18-Dec-02 23:49
Membermah18-Dec-02 23:49 
GeneralGreat Pin
Ancient Dragon14-Jun-02 2:05
MemberAncient 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
Membermah13-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
Membermah13-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
MemberAndrew 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
MemberAndrew 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
MemberTim 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.