|
By being overwritten, for example. In MSVC++ 6.0, you can set breakpoints on memory changing, this might help you. From the help file:
1. From the Edit menu, click Breakpoints.
2. Click the Data tab of the Breakpoints dialog box.
3. In the Expression text box, type the dereferenced pointer variable name (*p or p->next, for example).
4. Click OK to set the breakpoint.
You might want to consult the help file further (search for Breakpoint AND memory AND change, for example).
|
|
|
|
|
Ok.... dont know if i'm doing things the wrong way, but MSVC.NET gives me the message:
The following breakpoint cannot be set:
When 'g_resManager' changes
Data breakpoints are not supported in the Common Language Runtime.
I also tried to dereference g_resManager (which is a pointer) but that gave the same result..
|
|
|
|
|
Being the happy non-owner of MSVC.NET, I must direct you to the documentation for it. You want to set a breakpoint, and you want to set it when either the variable or the memory address changes. Search, man, search!
|
|
|
|
|
In the debugger, put a conditional breakpoint to see who or what is changing it
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Have you single-stepped through the code to see which statement is writing to the memory address in question? Consider the following:
1) char c1 = 'D';
2) char c2 = 'C';
3) int *i3 = (int *) &c2;
4) *i3 = 1234567; We never directly wrote to c1 or c2 , but c1 got changed indirectly. Setting a breakpoint on the first two statements would not show you anything as the "damage" does not happen until the fourth statement. Make sense?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
makes sense
|
|
|
|
|
Either you are doing it but just don't know your code well enough to to recall where. (This happens more often than you would think), or you are overwriting it thourgh some memory that isn't as big as you think it is. Look for a global array near that point that is one member too small or some such.
You might be able to get a clue by seeing what it was changed to. Pull up your debugger after this happens, and look in memory to see if there is something supicious, not just with the variable overwritten, but also others near that location. If it is a string you have a good clue.
Your confusion on how to find these is one of the lesser reasons to consider global variables evil. (There is sometimes no way to get around them, but the less you have the better, and any you can get rid of is generally good practice)
Good luck.
|
|
|
|
|
I have a simple dialog app which creates a child window as follows:
CModeless_testDlg *pDlg = new CModeless_testDlg;
pDlg->Create(IDD_MODELESS_TEST_DIALOG,this);
pDlg->ShowWindow(SW_SHOW);
The problem is that the child window is always on top of the parent window, even after selecting the parent. Is it possible to override this behaviour?
(I've set the parent dialog's 'Clip children' style but this does not seem to help. I also tried calls to change the Z order with no effect)
Any suggestions?
Mark
Yet another hardware engineer gone soft...
|
|
|
|
|
Maybe there is a better way, but you could destroy&recreate the one you want on top?
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Make your modeless dialog a child of the desktop.
pDlg->Create(IDD_MODELESS_TEST_DIALOG, NULL);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks for the suggestion, I tried that but it does not seem to make any difference.
|
|
|
|
|
How about:
pDlg->Create(IDD_MODELESS_TEST_DIALOG, GetDesktopWindow());
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Perfect, that works just right. Thanks for the help !
|
|
|
|
|
hi All
i am calling a modeless dialog from my doc class using
CCPServerWait* m_pWaitDlg;
m_pWaitDlg = new CCPServerWait;
m_pWaitDlg->Create(IDD_DCPSERVER_WAIT);
m_pWaitDlg->m_wait_mes = "Confiming School Details...Please Wait";
m_pWaitDlg->UpdateData(FALSE);
m_pWaitDlg->CenterWindow(CWnd::GetDesktopWindow());
m_pWaitDlg->ShowWindow(SW_SHOW);
m_pWaitDlg->UpdateWindow();
m_pWaitDlg->DestroyWindow();
now i have used this code successfully in other applications but in the current one is throwing out an error
on updatedata
i noticed when i debug that hWnd is equalling ????????
anyone any ideas ???
ta
simon
|
|
|
|
|
si_69 wrote:
throwing out an error
on updatedata
It would be far easier to help you if you elaborated on this. With the amount of info given, I can only say that you probably have a bug
|
|
|
|
|
The reason this code fails is you are trying to manipulate a nonexistent window. Lose the call to UpdateData() . Instead, call SetWindowText(m_wait_mes) in the dialog's OnInitDialog() method. Move the CenterWindow() call to the OnInitDialog() method, too.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanks for that
before i display my modeless dialog, i call
ok = SQLCreateDataSource(m_hWnd,"CP_CMIS_CON");
now if i omit that, then my code works ok, but
with it then i get the errors
|
|
|
|
|
si_69 wrote:
ok = SQLCreateDataSource(m_hWnd,"CP_CMIS_CON");
What is the value of m_hWnd ?
si_69 wrote:
...then i get the errors
And those errors are?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
im calling a dialog (dialog A) from OnNewDocument in my doc class
then in dialog A i call the
SQLCreateDataSource(m_hWnd,"CP_CMIS_CON");
m_hWnd is equalling to (when i step through)
m_hWnd 0x000f0664 {unused=??? } HWND__ *
this displays the Create DataSource dialog ok, the user creates a
datasource, once complete the user is back to dialog A
after OnOK has been called in dialog A, control goes back to
OnNewDocument and the modeless dialog is displayed
hope that makes sense
DavidCrow wrote:
And those errors are?
sorry i should have mentioned, these are the errors i was originally getting, when i first posted the message
thanks
si
|
|
|
|
|
si_69 wrote:
...these are the errors i was originally getting, when i first posted the message
But if you removed the call to UpdateData() and replaced it with a call to SetWindowText(), and moved it and the call to CenterWindow() to OnInitDialog(), you would not be getting the same errors.
Show us the OnNewDocument() and OnInitDialog() code.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi.
my problem:
<br />
double a=98;<br />
double b=100;<br />
double c=98/100;<br />
and why in delphi, vb, etc. i got the 0.98 but not in c++.
I even tried the /Op compiler setting and nothing.
I have readed the microsoft workaround of adding 1e-10 but does not work.
What should i do?.
Thanks in advance.
|
|
|
|
|
There is a very good chance that Delphi and VB are getting the exact same result but due to how they are displaying the number you as seeing a different result.
Floating point math is not exact.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
double c=98/100;
would give
c = 0.0 as 98/100 is integer arithmetic, it is then case to double!
OK,
double c=(a/b) + 0.0000000001;
will give c = 0.98
NOTE: This work around only makes the answer correct to 10dps.
If you change everything to float you will probably get a different answer. These calculations all depend on the format of the floating point number and its precision.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
How a double (or float ) is stored in memory and how it is displayed are two different things.
http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
http://www.fact-index.com/f/fl/floating_point_1.html (see Problems with floating-point)
http://www.hal-pc.org/~clyndes/computer-arithmetic/floats.html
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
lot of interesting readings
Then i found it!
COleCurrency is all i need
Thanks to all
|
|
|
|