|
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.
|
|
|
|
|
|
I would like to remove focus editbox when user press Enter key(like Tab Key)
I can do it on create project by Dialogbase but can't do it on SDI
In CFormview
Now! I can't get Message for check press Enter key.
Please show example to me..
|
|
|
|
|
You can do this in PreTranslateMessage for the CFormView derived object.
You need to be careful, since some edit controls will WANT the enter key (if, for example, they are multiline).
Steve S
|
|
|
|
|
I found that both CInternetSession.OpenUrl(...) and CHttpFile.SendRequest(...) write cookies automatically after return. but I really want to control this by myself, or can I prevent wininet from writing cookies, and them let me use SetCookie(...) to do seperately?
by the way, I do it at syc mode, for someone says wininet asyc is not multithread-safe.
|
|
|
|
|
I would like to know how to programatically change change the colour of the text and background of the combobox's dropdown list.
Many Thanks
|
|
|
|
|
Hi All,
I have a touch screen application and on one part of this i need the user to set the time. I have a CDateTimeCtrl to show the time to be set and buttons numbered 0 to 9 to allow the user to set the text for this. I have tried sending WM_KEYDOWN/WM_KEYUP/WM_CHAR messages when the user clicks one of these buttons to set the time but this has no effect, can anyone help me with this.
Cheers
Andy
|
|
|
|
|
Check out MSDN. See the messages that CDateTimeCtrl processes.
Kuphryn
|
|
|
|
|
i want format a disk in a way of calling APIs or MFC method rather than calling like this:
ShellExecute(NULL, NULL, "format", "A: /v mylabel", NULL, SW_HIDE);
Hello World
|
|
|
|