Hi all.
I am seeking to learn how to link my drag/drop GUI's to the code I wrote for a program from some 9 years ago.
I.e., I have Borland, and MS's Visual Studio 6.
I used both-- at different times-- to create a program, and was able to use Borland's compiler to make a windows type, DOS-based program, that had inputs, and outputs.
It actually worked really well. That was where I got greedy, and wanted to make a Windows-type GUI interface for everyone, across all platforms to use.
However, after my C++ classes at my local college, and university were through, I realized I never learned how to link my inputs to input boxes, and outputs to output boxes on a user form GUI.
One former acquaintance of mine showed me some basic stuff in Visual Basic. But I either did not pay close enough attention, got lost in between, or the two languages are completely, and thoroughly different-- which actually would not surprise me. Of course I can be equally notorious for not paying attention too.....

Also, I suppose I should say that based on what I've learned in my recent experiences with Excel macros, it appears that my user input boxes must be named identically to my user input variables. As would be my user output boxes must be identically named to my user output variables.


So.....
Where do I start to get the info to link my GUI's to my code?
Thank you to all.

Recommended Answers

All 15 Replies

IMO you should not try to integrate the gui into that old DOS code, but rather to write a whole new GUI that includes the features of the old code. First create the gui windows and dialog boxes the way you want them. After you finish that you will probably realize how you can integrate the non-visual features on the DOS program into this new program.

And stop using VC++ 6.0 -- its too old now. Download the free VC++ 2008 Express because its a lot better c++ compiler.

Another alternative is to learn and use C# because its easier to create GUI with C# than it is with C++.

Hi Ancient D.,
Ok, I've installed the VC++ Express, and have started a "new" project.
I've also imported my cpp code from the old program.
I then did a compile.
It ran through and gave me 5 warnings, and 1 fatal error.
The warnings appear to be due to my use of the Borland *.h files used for solving math programs.
stdio.h, math.h, iostream.h, conio.h, iomanip.h.
The fatal error appears to be my former gui cpp files.
I.e.,

------ Build started: Project: HipValley, Configuration: Debug Win32 ------
Compiling...
Code Angle_Finder.CPP
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(4) : warning C4627: '#include <iostream.h>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(5) : warning C4627: '#include <math.h>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(6) : warning C4627: '#include <stdio.h>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(7) : warning C4627: '#include <conio.h>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(8) : warning C4627: '#include <iomanip.h>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(11) : fatal error C1083: Cannot open include file: 'intro_sht.cpp': No such file or directory
Build log was saved at "file://e:\Steve'sDocs\Visual Studio 2008\Projects\HipValley\HipValley\Debug\BuildLog.htm"
HipValley - 1 error(s), 5 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Once I began tinkering, I removed the old cpp #include for my former forms.

At this point I think I need some location sources to read. Any recommendations?
Thanks.

There are going to be many porting issues. Just take them one at a time. For example, iostream.h is depricated (obsolete). use <iostream> (without .h extension) instead.

>> skipped when looking for precompiled header use
The first line in *.cpp files with that compiler needs to be #include "stdafx.h" because that is for precompiled headers. Several compilers use precompiled headers, and Microsoft compilers typically using stdafx.h, although you can change the name of that file if you want to. You can also turn off precompiled headers.

>> fatal error C1083: Cannot open include file: 'intro_sht.cpp':
That error should be obvious to you. The error message of quite explicit.

>>At this point I think I need some location sources to read. Any recommendations?
I don't know what kind of documentation you are looking for. Instructions on how to use the compiler? Or what ?

There are going to be many porting issues. Just take them one at a time. For example, iostream.h is depricated (obsolete). use <iostream> (without .h extension) instead.

Ok, so I no longer use the <iostream.h> , and now just use <iostream>

>> skipped when looking for precompiled header use
The first line in *.cpp files with that compiler needs to be #include "stdafx.h"

because that is for precompiled headers. Several compilers use precompiled headers, and Microsoft compilers typically using stdafx.h, although you can change the name of that file if you want to. You can also turn off precompiled headers.

I'll read on this further.


>> fatal error C1083: Cannot open include file: 'intro_sht.cpp':
That error should be obvious to you. The error message of quite explicit.

Yes, I actually removed all of those references out, or for the time being commented them out.

>>At this point I think I need some location sources to read. Any recommendations?
I don't know what kind of documentation you are looking for. Instructions on how to use the compiler? Or what ?

No, I'm thinking something that would be more on the newer C++ language. As it appears I'm about 7 to 9 years out of date on my C++ knowledge, and was always quite limited to what is taught in a sophomore college class for it. The logic is far clearer than it was back then, but I'm still limited to just my exposure on VBA, and wanted to expand it.

My next question is specifically to the VC++ Express program.
Is there a drag/drop tool in it, as was in the older Borland, and Visual Studio?
I haven't been able to identify anything just yet, and have also been just trying to get my existing code to work.
Again, thanks for your time.
Best.

AD,
I found some reading material in the help file-- as long as I pick specific terms.
Since you made mention that iostream.h is obsolete, and I should drop the .h extension, and just include the <iostream>, I found that after dropping the .h file extension for each of my elements- conio, math, etc...-- that I'd obtain a single failure for each.
Once I got to the end-- removing the .h, and then finding it needed to be replaced, the iomanip was my last. I found that it does not work with the .h file extension, however, in removing it, I then run the "clean build solution" option, and then do a "rebuild solution."

This then brings up 108 errors, and all of them are my cin, cout, math functions, etc....

Which is really confusing at this point because those were the elements used for input, and output, and the various math functions- atan, pi, acos, etc....

So I went into read more on the iomanip, and found the headers section of the help file.
<math.h> is no longer a part of that list. Is that too obsolete? I saw two others that appear to be replacements- <algorithm>, and <functional>.
Do I now include those, and no longer include the <math>?

This is part of why I mentioned in my last post it appears I need some updated information to read so find out what's obsolete, and the respective replacements.

Hi again,
I did some digging online and found some downloadable E-books on VC++.
I've solved some of my problems.
1- the cin, cout now requires a different initiation than before.
using std::cout;
using std::cin;
2- math.h has been changed to cmath (inspite of the fact that it still actually calls to math.h).

I have however found another issue.
It's telling me that the >> "operator" is not recognized, and no substitution for it.
I'm using this for my cin >> __;
I do not understand this, nor have I found a solution to resolve it. Everything I've read in the help file says that this is the correct usage of the >>. The language the error gives is between the hyphen lines.

-----------------------------------------------------------------------------

..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(94) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'int (__cdecl *)(int)' (or there is no acceptable conversion)
E:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(1144): could be 'std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char *)' [found using argument-dependent lookup]
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
--------------------------------------------------------------------------------------

The next thing that appears to have arisen is that accessing my mathematical/trig operators appears to now require something more to use them beyond math.h or cmath.

I've found that my basic - + = != < > etc.... operators are accessed by the
using std:: operator __; form.

But in looking for some explanation on the accessing of the trig functions, they're limited.
Here are the errors I keep getting here.

------------------------------------------------------------

while trying to match the argument list '(std::istream, int (__cdecl *)(int))'
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(95) : error C2665: 'abs' : none of the 5 overloads could convert all the argument types
E:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdlib.h(380): could be 'int abs(int)'
E:\Program Files\Microsoft Visual Studio 9.0\VC\include\math.h(485): or 'long abs(long)'
E:\Program Files\Microsoft Visual Studio 9.0\VC\include\math.h(487): or 'double abs(double)'
E:\Program Files\Microsoft Visual Studio 9.0\VC\include\math.h(491): or 'float abs(float)'
E:\Program Files\Microsoft Visual Studio 9.0\VC\include\math.h(539): or 'long double abs(long double)'
while trying to match the argument list '(int (__cdecl *)(int))'

-----------------------------------------------------------

..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(103) : error C2296: '*' : illegal, left operand has type 'int (__cdecl *)(int)'
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(103) : error C2297: '*' : illegal, right operand has type 'int (__cdecl *)(int)'
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(103) : error C2296: '*' : illegal, left operand has type 'int (__cdecl *)(int)'
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(103) : error C2297: '*' : illegal, right operand has type 'int (__cdecl *)(int)'
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(103) : error C2296: '*' : illegal, left operand has type 'int (__cdecl *)(int)'
..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(103) : error C2297: '*' : illegal, right operand has type 'int (__cdecl *)(int)'

-----------------------------------------------------------

..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(170) : error C2297: '/' : illegal, right operand has type 'int (__cdecl *)(int)'

-----------------------------------------------------------


So, my error count has now dropped to 26, and my warning count has risen to 4.
But since I've appeared to be bouncing all over the place, who knows how much is different between VC++6.0, to VC++ 2008.........


..\..\..\..\Pers. Docs\Misc\Steve's book\final_draft\Code Angle_Finder.CPP(94) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'int (__cdecl *)(int)' (or there is no acceptable conversion)

Could you post line 94 of your code and if any variables are used in that line, please post the declaration of them.

who knows how much is different between VC++6.0, to VC++ 2008.........

Not that much actually, so don't worry ;)

niek_e,
Sure,
here it is:

cin >> x; // Input Rise1

my cout is identical, in that I'm using <<:

cout << " ie Y/12 format, input only the Y value." << endl; // explanations

As mentioned, I do not get this. This was the way we did it in 2001, and earlier.
I looked up online, and helpfiles, and they all say that this is still the correct way to perform this task.

Thanks for your input.
Best.

here it is:

cin >> x; // Input Rise1

As what is 'x' declared?

x is declared as an integer-- in the fashion as it was used in 2001.

int  x;  // for data input

Actually, here it is.
I remember now that with some of my reading over the weekend, I found that the declaration of variables was different, and so I made the modification as shown below.

int  x(int num);  // for data input

I will say that I do not understand why this would be different than in times past.

x is declared as an integer-- in the fashion as it was used in 2001.

int  x;  // for data input

It's still the same. The standard hasn't been changed since '99 (the c99 standard). Perhaps you forgot to include some stuff?
Does this work on your compiler:

#include <iostream>

using std::cout;
using std::cin;

int main()
{
  int x = 0;
  cin >> x;
  cout << "X = " << x << "\n";
  return 0;
}

And stop using VC++ 6.0 -- its too old now. Download the free VC++ 2008 Express because its a lot better c++ compiler.

this is a moot point, it depends what your using it for etc, as an example: it still optimizes WAY better than dev-cpp's mingw gcc compiler, the generated asm is also far cleaner, but the MS funcs are bloated in some instances...

it still optimizes WAY better than dev-cpp's mingw gcc compiler,

That's like saying: this 30 year old car is still way faster then a bicycle, so I don't need a new one.

The new VS2008 is a lot better then VC6 and best of all: it's free (express). So why not update?

Necro- I am now using the VC++ Express 2008.
Once I got started posting, and Ancient Dragon responded, I immediately downloaded, and installed it.
I haven't had Borland, or Visual Studio 6 on here since 2003. I've upgrade from a 6gb hdd to a 40gb drive, and have gone through at least 2 full reinstalls of windows, and all my programs. Those two basically went the way of the dodo bird for a lack of need. Now they collect dust in a plastic box that's in my garage.

Niek_e,
You said-- I could've missed something.
The last time I ran this under Borland, and under VS6, it worked, no errors, no troubles, etc....
I use to have a windows executable file from it back in 2001. Since I was new to programming, it was among one of my most satisfying acheivements.

As I toyed with it, I realized that I wanted a genuine cross-platform program, and began tinkering with J+, and used the drag/drop builder to create a series of forms, and then tried to figure out how to link them all... I wound up paying my C++ tutor at the university here to do it for me. It worked great until XP was released, and then I couldn't get it to work any longer, as soon as I converted my hdd to NTFS from Fat 32.

Last year I was talking with a colleague who is good at programming, and he turned me on to Sun's NetBeans IDE. I've tried toying with that, but I kept running in to walls that I just couldn't quite get it. I finally set that aside in frustration.

Last month I stumbled across WXwidgets. It said that it was a Java converter for C++. Once I read more on it, I realized that I could finish programming this in C++, and then convert it to Java-- this time REAL Java...... and not M$'s wanna-be version.

I do have an idea.... I'll re-write this from scratch, instead of just importing my cpp file from days of yore. I'll admit I was trying to do this the "easy" way, based on the assumption that what worked then, should work today.
You said that everything is identical, correct?
So I should be able to use all the same code, and just have a fresh file.
I still want to keep this thread open so I can figure out the GUI's. My initial assumption was that my cpp file would just make the switch, and I could jump right in to the gui's. So much for my assumptions..... lol....

Thanks.

That's like saying: this 30 year old car is still way faster then a bicycle, so I don't need a new one.

The new VS2008 is a lot better then VC6 and best of all: it's free (express). So why not update?

bad example(apple with pears sort of thing), lets put it this way:
i use VC6 over vc2005ee for a few simple reasons:
1) i don't like (sky).net, VC6 was the last "clean" version
2) my vc6(pro) compiler can optimize FAR better than M$' crippled freeware versions
3) it does what i need, and i don't have the net to dl new stuff all the time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.