|
Sounds like a TZ issue.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
If the same piece of code runing on the same PC gives a different answer depending on if it's compiled with VC6 or VS.NET then it has to be a bug.
I can't see any other explaination
|
|
|
|
|
Not necessarily. Default values have been known to change from version to version. That would not be considered a bug.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Mike Dimmick has it right. FindFirstFile is working as documented. It returns the last write time in UTC. The behavior you are seeing in VS.NET is documented; the UTC time is NOT converted to local time.
I suspect the change was due to MFC using the ATL class versus it's own. I do know that the new implementation is much smaller than the previous one.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
You are right it behaves as documented. However, it previously didn't work this way in VC6 and that's why I put this post here.
because the behavour changes from one version to the other subtle hard to find bugs will be introduced into your application simply by compiling with VS.NET instead of VC6.
|
|
|
|
|
Hi guys,
I was told it's the best to access components of a dialog using DDX control, instead of GetDlgItem. But I think I make some obvious mistakes that have kept me from successfully using the DDX. The problem is like this.
I have two dialogs with their own classes (CMyDlg1 and CMyDlg2). The dialog 2, CMyDlg2 has a Static Text, which I had created a DDX control for it, called m_TextName. What I wanted to do was to open (modal) dialog 2 by clicking on a button in the dialog 1, in the meantime, set the text of the static text in the dialog 2. So what I did, was to have the following in the dialog 1's button clicked function:
void CMyDlg1::OnBnClickedButton1()
{
CMyDlg2 MyDlg2;
MyDlg2.m_TextName.SetWindowText("Testing text");
MyDlg2.DoModal();
}
And it'd cause the app to crash when the button of the dialog 1 is clicked. In the debug, it clearly showed that this line
MyDlg2.m_TextName.SetWindowText("Testing test");
causes the error.
As it looks legal to me in the C++ perspective, could anyone tell me what it could wrong?
Please help.
Thanks alot.
|
|
|
|
|
Simple. You've created the dialog object, but none of the windows controls exist until deep inside DoModal(). The CStatic or whatever it is for m_TextName exists, but the first thing that SetWindowText will do is determine whether 'this' refers to a window. At the point you call it, it doesn't, so it faults.
You can get around this by having a public CString member (or even a method that allows you to set a private/protected member) in CMyDlg2, then your CMyDlg2::OnInitDialog
can call the base CDialog::OnInitDialog (which processes the DDX map), then calls m_TextName.SetWindowText passing the CString.
There, doesn't that make you feel better?
Steve S
|
|
|
|
|
It was a quick reply Steve, thanks alot!
I will try it out now. But just a thought, if it's because the control did not exist before DoModal() is called, wouldn't swapping the DoMadal() and SetWindowText() work?
e.g.
CMyDlg2 MyDlg2;
MyDlg2.DoModal();
MyDlg2.m_TextName.SetWindowText("Testing text");
Interestingly, now the dialog 2 loads after the button click but the text is not set. And the app crashes after close the dialog 2.
Would you mind explaining why it acts like this?
|
|
|
|
|
Ok, to answer my own question,
I think because the DDX controls are processed through CDialog::OnInitDialog(), without calling it first , that CStatic m_TextName was never mapped and known to the window.
And when the dialog 2 is closed, the code proceeds to the SetWindowText line, which therefore crashes the app (m_TextName is not found).
|
|
|
|
|
Not quite.
The CStatic itself exists throughout the lifetime of the CMyDlg2 object. However, the window associated with it only exists during DoModal. The crash happens in both cases (before and after) for the same reason, that you're trying to operate on a non-existent window. The CStatic is really only a wrapper, which can exist with or without a window, but without the window it's pretty much useless.
It's better to use either DDX_Text and public members or else use methods that manipulate non-public members safely, and to put 'one-time-only' per dialog stuff into OnInitDialog, where it belongs.
The hard part is remembering that a CWnd (or derived class) is NOT the same as a window. It has to be attached or otherwise associated (via creation or subclassing) with an OS window.
Steve S
|
|
|
|
|
J.B. wrote:
But just a thought, if it's because the control did not exist before DoModal() is called, wouldn't swapping the DoMadal() and SetWindowText() work?
No, because dialog 1 does not get control again until DoModal() returns.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
hi,
my application is using mysql is database.i connect to mysql using mysql lib files. while connecting from the local host is not an problem. when i try to connect mysql from other machine. i found the following error
Host Auro5(Auro5 my machine name) is not allowed to connect to this MySQL server
any help to me. Thanks in advance.
Murali.M
|
|
|
|
|
there is no problem with your c++ aplication, you need to add the user who is connecting you mysqlserver into the mysql server.
My God is more powerfull Than Your God.
|
|
|
|
|
Look at your priviliges on that machine, not just your localhost login but how you are signed onto the local box.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Friends,
My question is related to the Add/Remove Programs dialog that can be opened from control panel of Microsoft Windows Operating Systems.
There are various enteries of curently installed programs there. These enteries are made by the installation program of particular appliation.
But from where this dialog box reads these enteries ??Actually i want to remove certain entry programatically. But i don't know from where to delete it. So that it cannot be shown in this dialog box. I can guess that this dialog reads these enteries from registry but i dunno where are they stored). Can any one tell me ?
|
|
|
|
|
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall Your uninstall program should remove these entries automatically when uninstalling.
|
|
|
|
|
Hi, I really nead a C (not c++) code for deconvolution of signals (not images)usign fft.
Is there anybody that can help me? I'll be very happy.
Thanks, Angeluna.
|
|
|
|
|
Hi!
How do I convert a hexadecimal number to decimal?
Thankful for your cooperation,
Stefan
|
|
|
|
|
hi,
use the following code.
char * hexstring= "A";
char * p;
int number = strtol(hexstring, &p,16);
Have A Nice Day.
Murali.M
|
|
|
|
|
hi,
in development system report is working fine. in application installed system, when i try to open the report, report is opened and closed immedeatly with flickering. unable to view the report. what's the problem. Any one help to me.
thanks in advance.
Murali.M
|
|
|
|
|
i Found solution for this. problem is using mysql odbc for database connection. mysql odbc driver is not installed on the machine and DSN is not properly configured.
thanks.
Murali.M
|
|
|
|
|
hi..
i am making a grid..and i am doin it like this
for(int x = 10 ; x <= 2000 ; x += 10) {<br />
pDC->MoveTo(x, -10);<br />
pDC->LineTo(x, -1000);<br />
}<br />
<br />
for(int y = -10 ; y >= -1000 ; y -=10) {<br />
pDC->MoveTo(10, y);<br />
pDC->LineTo(2000, y);
the grid is fine...
i am uing a CScrollView and so when i scroll the whole thing blinks and looks bad...
so i want to use GetClipBox..
if i use it..can someone pls help me out as to how should i implement it in my above code???
CRect clipBoxRect;<br />
pDC->GetClipBox(&clipBoxRect);
for(int x = 10 ; x <= 2000 ; x += 10) {<br />
pDC->MoveTo(x, -10);<br />
pDC->LineTo(x, -1000);<br />
}<br />
<br />
for(int y = -10 ; y >= -1000 ; y -=10) {<br />
pDC->MoveTo(10, y);<br />
pDC->LineTo(2000, y);
i dont know how to incorporate the clipBoxRect with my code in order to make the blinking go away.
can someone pls help??
tks for your time..really appreciate it..
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
use a memory DC draw on that dc and then transfer to main dc
a CMemDC class it available everywhere
in scroll handlers don't call invalidate call updatewindow
|
|
|
|
|
MailMonty is right, you should use a Memory DC to avoid blinkcing (and also override OnEraseBkGnd)
However, CDC::GetClipBox is useful to limit the redrawing.
First, if GetClipBox returns NULLREGION, no need to continue, no part of the window needs refresh. Next, the rectangle returned by the method represents the area to refresh, so you can limit the drawing to this area only.
A quoi rêvent les personnes qui nous font vivre ce monde ?
|
|
|
|
|
hi..this is regarding the anwer you gave me in codeguru regarding getclip box...
i am new in MFC and wouldappreciate if you could tell me how do i use a memory DC draw on that dc and then transfer to main dc please???????
would really appreciate your help...
also, i dont know how to use a CMemDC class annd have never used it before...so i am very new in that too....i would really appreciate if you could help....
tks a lot...
you can mail me at extremedotnet@yahoo.com.sg
tks a lot....really appreciate it.
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|