Solved

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

Posted on 2011-09-12
10
235 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
ID: 36524734
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
ID: 36526758
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
ID: 36528161
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 86

Expert Comment

by:jkr
ID: 36533562
Um, I thought that I even had recommended wxWidgets in my above comment ;o)
0
 

Author Comment

by:norman1312
ID: 36534260
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
ID: 36534483
Sorry jkr, obviously missed the last line of your reply. kudos to you
0
 
LVL 7

Expert Comment

by:tampnic
ID: 36535086
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
ID: 36535177
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
ID: 37419282
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

785 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