|
It sounds like you need to preface each of your struct/class types with a specially-formatted comment. Then you could write a parser that would scan .h and .cpp files looking for known types (e.g., int , bool , char ) and the aforementioned comments.
While not directly related, back in the mid 90s, I started using a product by Eric Artzt called AutoDuck. It was a utility he developed while working for Microsoft. It scanned source files for special comments and created .hlp files for developers to use.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
The problem is NOT how to parse the .cpp, .h in order to build the DataBase, but how to build the data base.
I've just given (as an example only) the possibility to read the data base and to generate .cpp and .h files (and not the opposite)
Thank you anyway
|
|
|
|
|
Michigan1854 wrote:
...but how to build the data base.
Ahh, I overlooked that minor detail.
I would create an empty database, with all relevant tables, from within Access. Then create a DSN (from the ODBC applet in Control Panel). Next, derive a class from CRecordset , which will ask you for the name of the DSN previously created. When you need to add a record to the database, simply use the AddNew() and Update() methods of this class.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I know how to access a data base, create by ACCESS from C++ (Using either ODBC, DAO or ADO).
What I do NOT know is how to organize data which is hierarchical by nature using a relational data base such as ACCESS?
If I had to deal with relational data, such as: (Table 1 related to Table 2)
Table 1: Client ID, Client Name, Client address
Table 2: Order number, Client ID
Client ID connects Table 1 to Table 2.
But how to organize in such tables recursive data.
struct FOO1
{
int a;
int b;
int c;
};
struct FOO2
{
struct FOO1 f1;
struct FOO3 f3;
....
};
|
|
|
|
|
Hello guys,
I need some suggestions on this.
I have two dialogs CDialog1 and CDialog2. CDialog1 has a ComboBox that contains a list of values. CDialog2 has a ListBox. The CDialog1 calls up CDialog2 using DoModal(). When the CDialog2 is up, its ListBox should be filled with the listed values in the ComboBox of the CDialog1 (of course, this would be done in the CDialog2's OnInitDialog()). Then in the CDialog2, the items in the ListBox can be changed and as soon as this dialog is closed (EndDialog()), the values in the ListBox will go back and replace the ones in the CDialog1's ComboBox.
As you can see, I need to either share these two members (likely via the use of DDX control) between the two dialogs or have the CDialog1's ComboBox fully accessible by the CDialog2.
I tried to create paired members (CComboBox or CListBox) in the other dialog for the original member, duplicate a copy and create functions to update the list on both sides whenever necessary. But the copying didn't work. I couldn't go, for example, in CDialog1 before calling DoModal,
CDialog2 dlg2;
dlg2.m_ComboBox = dlg1.m_ComboBox;
</code>
The other way I could think of is to use SendMessage() to retieve/update the ComboBox' values from CDialog2 to CDialog1. Or, I could simply make the ComboBox globally accessible through pointer for CDialog2.
Before I try anything, I'd really like to hear from anyone. What would be the best way (MS recommended way?)to go about it? Or could my first method be corrected?
Thanks alot
|
|
|
|
|
J.B.
I can only suggest the method that I have used in the past, so this may not ideally fit your requirements exactly.
J.B. wrote:
As you can see, I need to either share these two members (likely via the use of DDX control) between the two dialogs or have the CDialog1's ComboBox fully accessible by the CDialog2.
Directly accessing another objects UI control is for me a general no, no! This applies to worker threads as well as separate UI classes.
Share your information via a public member variable, declared in the dialog class being called. Since you are dealing with a number of distinct items, I would go for a container variable, such as an stl's vector class.
- Before calling DoModal(), fill the instantiated dialog class's vector collection with the list of items.
- In your OnInitDialog() overridden function, populate your now valid listbox/list control, with this member vector.
- On successful termination of your dialog (OnOk), modify the public vector variable, if any changes are needed.
- In your calling dialog function, use the returned vector of items to modify its control display.
This method has worked for me in the past, so you may find it useful in your solution.
I Dream of Absolute Zero
|
|
|
|
|
Thanks RChin!
I shall try that~
|
|
|
|
|
I'd use a public CStringArray object. It would save all the entries in the CDialog1 and you should write something like this for the CDialog2::OnInitDialog():
(Imagine that your CStringArray object has been called "my_array")
for (int i=0; i<my_array.GetCount(); i++)
{
my_list_object.Add(my_array[i]);
}
Bye !!
<hr><div style="width:100%; filter:Glow(color=003FB0, strength=5, strength=2);"><font color="#FFFFFF">Written by: Rafael Fernández López.</p>
Visit: <a href="http://www.maestroprogramador.com" target=_blank><font color="#FFFFFF">http://www.maestroprogramador.com</a></div>
|
|
|
|
|
Thanks Rafael, for the suggestion.
at the end I use std::vector as that way I'm able to not specify the size and that gives a bit more freedom to implement the number of elements restriction on ComboBox, if required.
|
|
|
|
|
Hi everybody,
We have a large scale C++ project compiled with Intel C++ 8.0 compiler.The project has excessive use of customized array class invloving pointers etc,pass by reference mechanism for function calls,floating point arithmetic, etc.The final output data is correct for debug version,but when we make the release version using Intel specific switches like O3,Qip etc the data is not matching.The difference is not visible in decimal values,but in last 1 or 2 bits of hexadecimal values of the variables.We checked even by disabling the optimizations for release version but still the results are not matching.We have come across situations like A = B + c - D * F all double values.B,C,D,F are correct but A is wrong.If we print B,C,D,F for debugging reasons suddenly A also gets corrected.Reasons??.We feel there may be similar situations elsewhere and instead of debugging if we get to know the reason behind this behavior of release version or any other probable cause of our failure we would be in a better position.
Thanx in advance
Chandra Prakash
|
|
|
|
|
Such errors are usually due to memory being overwritten. It is no easy task tracking down a problem though.
The following could be some of the causes:
1. Some data is being overwritten by another memory operation.
2. The double values are "spilling over".
3. If using printf() or similar function for debug output, it is possible the format specifiers are incorrect. Make sure the format specifiers are correct for the data type being printed.
4. Look for code using typecasts. Especially, code that tries to typecast and assign a value at the same time: (*(int*)&var) = 0;
Bikram
|
|
|
|
|
Hi
I've succesfully coded a Visual C++ .DLL that has some exported functions.
Now i'm having some problems using Centura strings and modifiying them.
I use the type 'LPSTR' as following:
In centura -> External declaration:
Function: GetFirmName
Parameters .. Receive string: LPSTR
In .DLL:
void GetFirmName(LPSTR pFrm)
{
strcpy(pFrm, "IMTESTINGAROUND");
}
Is this the right way to deal with strings in .DLL to Centura? I ask this in the VC++ forum because it is Visual C++ code but has to interact with a Centura program.
Greetings,
Jens
|
|
|
|
|
How to change the window title text font?
i want to change the font of the caption text in the window title?
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|
|
This article Custom captions[^] should be of help.
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
This is the code:
showed = sessionsettings->showed_inpat;
sortcol = sessionsettings->sortcol_inpat;
m_combosort.SetCurSel(sortcol-2);
m_combocolumn.SetCurSel(sessionsettings->filtercol_inpat);
m_editcolumnvalue.SetWindowText(sessionsettings->filtervalue_inpat);
activeRow = sessionsettings->selectedrow_inpat;
concrete example:
sessionsettings->selectedrow_inpat has value 4 which is correct.
However, when m_editcolumnvalue.SetWindowText(sessionsettings->filtervalue_inpat); is performed, this value magically changes to a random integer.
can anyone explain this? I already thought about pointers, but how is this possible?
(sessionsettings->selectedrow_inpat = integer, sessionsettings->filtervalue_inpat = CString, CString is made empty in constructor and is empty at the time when it comes to this part.)
(yes I know a solution would be to switch the lines, but I just want to know why why why??)
tnx!
|
|
|
|
|
Hi there,
I use VC Studio .net 2003. I have a project using math.h, which compiles without problems as Release project, but when I switch to debug mode I get 368 compiler errors for math.h
starting at line 182
_CRTIMP double __cdecl tanh(double);
_CRTIMP double __cdecl sqrt(double);
#else
int __cdecl abs(int); -> C2059 syntax error
double __cdecl acos(double);
double __cdecl asin(double);
Anyone got an Idea where this errors come from ? I would guess it has to do with project settings but couldnt sort it out so far.
thanks
ch
|
|
|
|
|
Its probably not that line, but the line previous to it that has the problem. It only get exposed in debug due to the way the #ifdef gets evaluated.
Take a look at the file that is including math.h and see what is just before it. Also, try getting the preprocessor to give you a file you can examine to see what the C++ compiler is actually getting. My bet is that you have a missing ";" in one of the files including math.h
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
Hi Roger,
I am afraid that is not the case, i checked the files including the math.h file and there is no ; missing. Anyway, how could this correlate with the problem solution by switching to the release mode ?
I am almost certain that it has to do with environment settings, since the project worked on my old machine, but after I set up my computer anew i can only run under release mode. It really pisses me off,
thanks anyway
ch
|
|
|
|
|
Hello Everyone,
I am working in a project. That require to write a program which can run at the same time in several computers but sharing the common data. The size of data is about 50MB.
Speed is a critical problem. Some operations allow all computers doing concurrently, but some operations allow one computer doing only (the data must be locked and have to synchronize to all others computers after that operation completed).
I need some suggestions about that problems (idea, URL, samples...).
Any advice is welcome.
Thanks.
|
|
|
|
|
One solution is memory-mapping. 50mb is no problem given the size of memory nowadays.
Kuphryn
|
|
|
|
|
When a menu is gone(the user clicks on an menu item, or hits the esc key, or clicks on the desktop, etc), can its parent window be notified? I only could find WM_INITMENU and WM_INITMENUPOPUP on MSDN, which are sent before the menu shows up, which are not I'm looking for...
|
|
|
|
|
There are WM_EXITMENULOOP and WM_UNINITMENUPOPUP , are those what you're looking for? You also get a WM_MENUSELECT with HIWORD(wParam)==0xFFFF and lParam==0 when the user cancels a menu.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
WM_UNINITMENUPOPUP is exactly what I was looking for, thank you very much Mr. Michael.
|
|
|
|
|
The Problem:
I have a lot of old code which (unfortunately) isn't thread based.
A click to a button causes an action or calculation wich may last some time - say 1 - 3 minutes for example. I use progress bars to communicate the advance of the process to the user.
Since XP I have the problem, that everything (the progress bar) stucks up if I am activating another window and switch back to the original one (only a white screen).
In 2000 the program beaves different. If I try to activate another window of the same application, or try to close the application, windows says that the programm is not reacting. If I click abort -> the progess bar keeps running. Switching to another application and back does not work in 2000.
Solution:
Redesing the Code to run in threads.
Question:
Is there another, simpler way to accomplish the update? I guess, I have to call the message handler function of the active window or give the OS some time to accomplish all window - events.
Can anybody help me? A simple Answer: "There is no way, you have to use threads, would be enogh".
Thanks a lot.
|
|
|
|
|
|