Solved

what can vc++ express do for input of win32 application?

Posted on 2011-09-12
10
231 Views
Last Modified: 2012-05-12
I have now converted part of a program originally written for Borland Turbo C (using OWL) to a M$ Visual C++ 2010 Express win32 application (NOT a console application).
I can now display the initial information in the window, but am trying to understand just how far I can go to be able to input data to the program. As it doesn't have MFC this may be a problem. The original program used dialog boxes to be able to add new data to the existing information.
As it doesn't have Resource Editing either this could be tricky, but I have the resource files from the original code. I can even display the boxes in VC++ 2010, but don't see how to populate them or read back any information.
Any advice or suggestions on how to procede next would be greatly appreciated.
0
Comment
Question by:norman1312
  • 2
  • 2
  • 2
  • +2
10 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
Comment Utility
You can use Windows' APIs to obtain user inpute, e.g. 'GetDlgItemText()' (http://msdn.microsoft.com/en-us/library/ms645489%28VS.85%29.aspx) etc. This a bit more tedious than using a GUI library, yet still works. For an example, see e.g. http://msdn.microsoft.com/en-us/library/ms644996%28VS.85%29.aspx ("Using Dialog Boxes").

BTW, if you are looking for a GUI library, I'd suggest wxWidgets: http://wxwidgets.org/
0
 
LVL 7

Expert Comment

by:tampnic
Comment Utility
jkr has answered your question about getting data into and out of dialog boxes..

As an aside, for your dialog editing needs http://www.resedit.net/ will let you edit your dialogs graphically. Its what I used to use before I upgraded from Express to the full version of Visual Studio. Just set up the include paths in the preferences to point to the headers in your Visual Studio installation, then open your rc file.

HTH,
  Chris
0
 
LVL 1

Expert Comment

by:philrosenberg
Comment Utility
As tampnic said jkr has answered your question about dialog boxes, however if you are interested you could make use of the wxWidgets library. This is an open source, cros platform free library which includes features from one line functions to generate massageboxes, input boxes, file selection dialogs etc all the way up to designing multiple frame applications. There is a windows installer available from http://wxpack.sourceforge.net/ which will add a wxWidgets project into VC++ Express. giving you a starting point and tutorials are all over the web.
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
Um, I thought that I even had recommended wxWidgets in my above comment ;o)
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:norman1312
Comment Utility
Well so far I've been able to generate and populate a dialog box (without using any other tool). Next is to catch the OK/Cancel response so I know what to do when the window closes. So I'm hoping I won't need to use wxWidgets (we shall see). After that is trying to work out the code to populate/check a radio button.
Old story, I know what I want to do (have done in other language) but frustrated there is no simple primer on basic (!) GUI functionality.
0
 
LVL 1

Expert Comment

by:philrosenberg
Comment Utility
Sorry jkr, obviously missed the last line of your reply. kudos to you
0
 
LVL 7

Expert Comment

by:tampnic
Comment Utility
In the message procedure for your dialog box (this is a callback function which is set when you create the dialog), you will need to handle the WM_COMMAND message. Here's a snippet which is part of a Windows app I wrote a few months ago - showing where I handle IDOK and IDCANCEL in the message switch block.

 
case WM_COMMAND:
            switch(LOWORD(wParam))
            {
                case IDOK:
                    sqlite3_exec(App->getDB(), "COMMIT", 0, 0, 0);
                    EndDialog(hwndDlg, 0);
                    return TRUE;
                 case IDCANCEL:
                    sqlite3_exec(App->getDB(), "ROLLBACK", 0, 0, 0);
                    EndDialog(hwndDlg, 0);
                    return TRUE;
            }

Open in new window


jkr has answered your original question and should get the points - you might want to open a new question for this.

Cheers,
  Chris



0
 

Author Comment

by:norman1312
Comment Utility
Actually I've just worked it out myself. Thanks anyway.
Still on input, I'm trying to set and read which of two radio buttons is set, but my old code uses CheckRadioButton and that doesn't seem to work. What should I be using?
0
 
LVL 40

Expert Comment

by:evilrix
Comment Utility
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now