you will have to come up with some kind of data structure which maps a string to a variable. maybe put the variable name in the structure itself, then search your collection of structs to find the one you want. or, create a std::map which uses a string (var name) as the key and a struct as the value. or... there are lots of options - none of them are great.
Please do not cross-post! It just makes it harder for everyone to gather the sparse information that is already there[^], and makes people waste time repeating the same queastions and suggestions in two different places!
Instead, please answer the questions, especially what you need this for. The answers to these questions are really necessary for us to make a meaningful response that actually helps you with your problem. As long as you're silent about your real intent, we can only guess! And, judging by the little information you gave us, you don't know what you're doing. Much less do we.
Also, please respond to the suggestions already made, whether or not they fulfill your purpose. If you ask a question, you expect a response. Likewise, the people responding expect that you indicate when that wasn't helpful, and why.
P.S.: Just to make a point and explain why I think you do not know what you'r doing or asking:
The name of a variable in a program only really makes sense to the programmer who wrote it. The same object stored under that variable name may be stored under a different name in another part of the program. Likewise, a different part of the program may store a different object under the same name.
As a result, the user of the program can never tell with certainty what the name of a specific object in the source code of the program at any given time is. the only way to tell this, is if you are looking at the source code that is currently executed, i. e. if you are debugging the code. Is that your purpose? If so, the task you're on is likely a whole lot more complex than you can imagine. If not, you're probably asking the wrong question, and you need something different than what you're asking for.
I have an MDI application ... somewhere, I had open an CDialog derived dialog, where I have only two buttons ... but in this dialog I can not catch any OnKeyDown event ... why ?
I had tried in follow way:
This is no joke, so please no “update” suggestions, OK. I have regretfully downloaded both VS 2010 and VS2008 to do some testing with Cmake. Now my VC 6.0 is building DSW and SLN and some other crap files – but no DSP! The most visible result is – no more access to “workspace”, my VC IDE is toast! I am about to delete all the new crap I downloaded and start over. I recall that when MS came up with VB4 the developers had similar problems working with older VB.
Any other suggestions to fix this? I really need to finish the project in VC 6.0 than MAYBE switch to VS2008, but this is nuts. Only serious replies will be appreciated, not in the mood. Cheers Vaclav
No, I load workspace using DSP project file. When I compile it my "workspace" window freezes. I cannot move aroudn the files , no scroll, and or when I click on any file I get something I assume is pointer failure and the IDE closes. I am not smart enough to troubleshoot the compiler problem like this one. When I check where the original project DSP file was I got SLN and DSW and some other junk there. When I got rid of the SLN file it partially worked again. I did get rid of all VS downloads and have no more of this problem. It sure looked like when you are using VS on VC programs and you get the "it was compiled with... do you want to convert to ..." , but it does the conversion half baked and automatically.
I did have some partial 2012 files which never completed the download. It seem that some of the new stuff will work only in Win7 but it is not advertized as such.
I did not try to run the sln file. It would be interesting what would happen. Vaclav
When I check where the original project DSP file was I got SLN and DSW and some other junk there.
So you tried to update the project to a newer version of the IDE; again which one?
it does the conversion half baked and automatically.
That has never happened in my experience. Did you keep backups of your original files?
I did not try to run the sln file.
.SLN files are merely text files containing XML which describes the names and locations of the projects witihn a solution. It is used by Visual Studio to access the project files, and hence the source files and build rules.
Understanding the structiure of Solution and Project files is important when using any version of Visual C++ or Visual Studio. MSDN contains information about them, and Microsoft has a forum dedicated to the subject.
Richard, Fortunately I archive my project after each major task is completed. As far as I know only VS / VC6.0 has DSP project files, but I may be wrong. I guess my the main question remains - why does my VC IDE bombs out when I have ANY VS 20xx installed and I am not using them. Thanks for all you comments. Vaclav
why does my VC IDE bombs out when I have ANY VS 20xx installed and I am not using them.
Sorry, no idea. As I said above, I have done this myself without problems in the past. I can only assume that you tried opening one of the VC6 solutions in a later Visual Studio which converted or somehow corrupted one of the project files.
The problem is obviously that you converted the old workspace into a new one (.dsw to .sln). After that you can't use it anymore with VS 6. Your best option is to revert to the files you had before conversion. If you don't have a backup you can either try to open the .dsw file (that contains the old workspace information for VS 6) or you may try to recreate all the projects, add the source files and hope that you get the project settings correctly.
I have installed VS 6 and some newer ones (up to VS 2010) in parallel on my machine. Usually this gives no problem. The key rule is: Always keep the projects separate, never open a project in anover VS version than it is intended for.
VS6 also used x.sln files but they were for web projects (and maybe something else?). If you end up with a x.dsp and x.sln file with VS6 then something is confused. I am doubtful that it will work. You probably want to delete the x.sln file, go to VS6 and select "Start a new project" and add your existing x.dsp to it. This should create an x.dsw file for you. If it creates or tries to use the x.sln file then something is wrong...
Thanks, unfortunately I just deleted the sln and it did not help. I have no VS greater that 6 on my box, so everything works in VS 6.I may try adding VS 2008 again to test the CMAke. Many thanks for your input, appreciate it.
This also partialy explains why I can start a new project from dsw file but I cannot add DSW into existing project - IDE complains.
I was wondering what advice can you give on how to create a data/business model in C++. I mean, when working with C# I usually have no problems, simply follow .NET's guidelines, but it seems there aren't guidelines in C++ on this regard. Is there any example you'd like to share?
I'm thinking common scenarios like a sales system (product, warehouse, pricing, purchase order) or a search inverted index (term, documents, posting, posting lists, dictionaries).
You could overwrite the OnChange Handler (I think it was EN_CHANGED or something like that) and manually get the text, check for any non-digit and remove it. Then set the corrected Text with SetWindowText(), or ReplaceSel().
There are however several pitfalls you need to avoid. First, setting the text programmatically also calls the event handler, and you need some status variable to prevent "recursive" calls.
Second, You need to take the cursor position into account. When you call SetWindowText(), usually the whole edit control content is selected. You could set the cursor position to the end with SetSel() (IIRC you need two calls, one to mark everything and at the same time set the cursor to the end, a second one to mark nothing and leave the cursor where it is.) Since the user may have entered something in the middle you may want to get the cursor position before changing anything (with GetSel()) and set it back to that position later.
I usually avoided these issues by letting the user enter the wrong values and checking them when the control lost focus, unless where was a strong argument against this approach.
I'm not sure where should I post this but it's part of the code in Clips (C Language Integrated Production System ) environment which is software tool for building expert systems.
please let me know where should I post it?
You've been told that this forum isn't suitable, yet have decided to post here again. No matter how may times you post CLIPS != c || c++, the c=part denotes it can be integrated with c-based systems. Additionally CLIPS is relatively specialised, rule based programming is different to the way c operates.
All this adds up to one thing: the advice I have seen here so far is spot-on: don't post this here as this isn't the correct forum and few people here will have an interest in CLIPS, your chances will be vastly improved by posting on a specialised CLIPS forum where everyone is there as they know about/are interested in it.
The defrule for Rule0 has an unbalanced number of brackets BTW my guess is there is one missing at the end of the "not" line, and the ? after tank-is-full looks suspicious. Of course I know next to nothing about CLIPS, which is why going to a CLIPS forum would be so handy.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
yeah, I do that but I didn't get any answer so I post here.
yours help a lot because every time I check every thing else rather than brackets. I didn't pay attention to that at all, it was just frustrating to check sth again and again and don't know what to do.
my problems solved, THX
A couple of weeks ago, I got this nasty rash on my mouse clicking finger. I posted a question to a medical site but nobody answered. I figured that since I was writing a C++ program when it started to hurt that I would repost my question here.
hello everybody :
i want to ask i recently downloaded a C++ source code , i just want to make program executable ( i mean make it binaries)like linux ,
is there any free program that do and make the setup file .
Thanks anyway .
You need to create a project, add the source files to it, compile it and fix the compiler type errors if any.
After this process, you will have an executable.
As for creating a setup program, you can use the free Wix Toolset.
It will integrate with Visual Studio so that you can create the setup program from Visual Studio itself.
You can download it from here - http://wixtoolset.org/[^]
Here is an extensive tutorial on Wix - http://wix.tramontana.co.hu/tutorial[^]
«_Superman_» I love work. It gives me something to do between weekends.
Here's how to make a simple .exe (application executable program) in Windows, copy this source to a file that will call main.cpp
// We will declare our header files as our first column
#include<iostream>// Declare namespaces as the second column
// "int main()" serves as the starting point for our program
cout << "Hello user!" << endl;
Compile this and go to your project's folder and double-click on a folder called bin and then double click on the folder called debug. If its not in there click on the other folder which is called release, if you managed to accidently compiled a release version of your program.
And there it is, your first made .exe file.
Simple Greetings and Regards,
Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst).
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
Last Visit: 31-Dec-99 18:00 Last Update: 27-Sep-16 18:03