|
I know this kind of hassle with the stupid UpdateData() part. There is so much happening behind your back, you never know what went wrong! I tend to drop DDX/DDV entierly, have the class wizard make me some control-variables and do the data transfer myself.
I know when to do what, like validating on each keypress, or on the TAB-key or..or..or.
All DDX/DDV can is validate on OK-Button.
Having said that, All I can think of at the moment is the following:
The variable you are setting IS connected with the right control?
Look it up in the DDX_TEXT() macros at the top of the cpp.
You can set a breakpoint on the macro and step through the DDX-function.
Hope that helped
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Well, sometimes we are stupid and sometimes we don't follow the docs. That's what happened with me.
I was reading a particular value from a file. After that I was bitwise OR'ing it with a few numbers to see what was up and assigning the result to a BOOL ean variable (which was connected to a checkbox). I forgot that if the value is anything other than 0, 1 or 2, the DDX routines will reset it to 0.
DOH!!!
Thanks to your advice of stepping through the code (why didn't I think of it myself?) I was able to spot it.
Thanks again for listening to me and offering your suggestions. It helped me a lot.
About doing the data transfer yourself, I avoid it as much as possible, because in most cases it's not necessary and I don't want to have to remember to do it each time. Data validation is a different game though. Best done by hand.
Regards,
Rohit Sinha
Do not wait for leaders; do it alone, person to person. - Mother Teresa
|
|
|
|
|
Souns like a silly, I assume you are using the MFC? try deleteing and the name of the member variable of the check box and then compile, are there any errors.
Now add a new member variable name, and set it TRUE or FALSE manually.
If this fails then you are probably overwritng some memory location.
Or comment out everything possible from the class, does it still fail?
Good luck!
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
|
|
|
|
|
You're likely to solve the problem by using member control variables instead of UpdateData() . See jhwurmbach's comment.
|
|
|
|
|
Hi dear,
I created a thread.
But when I start the thread CPU load become 100%.
I use these code.
<br />
void CtestDlg::BeginThread()<br />
{<br />
m_isRunning = TRUE;<br />
AfxBeginThread(ThreadStart,this,THREAD_PRIORITY_LOWEST);<br />
}<br />
<br />
UINT CtestDlg::ThreadStart(LPVOID pParam)<br />
{<br />
CtestDlg* pDlg = (CtestDlg*)pParam;<br />
if (pDlg == NULL || !pDlg->IsKindOf(RUNTIME_CLASS(CtestDlg)))<br />
return 1;
<br />
while(pDlg->m_isRunning)<br />
pDlg->Start();<br />
<br />
return 0;
}<br />
<br />
void CtestDlg::Start()<br />
{<br />
}<br />
Start function doesn't have any code.
Thank you in advance.
|
|
|
|
|
your while loop will generate 100% cpu, since you dont have any kind of blocking code inte CtestDlg::Start. What the CPU is doing is calling Start all the time.
Magnus
|
|
|
|
|
I´m new to DirectX 8.1 and I have a problem in windowed mode. When I use SDI type app and tris are rendered in filled mode, when I resize a window, the app works correctly. Image stretches, but correctly, same way as OpenGL does. But when I switch to wireframe, all goes wrong. Lines appear thinner or thicker, as if you stretch a bitmap. In MDI, when I use additional swap chains, this problem occurs everytime, i.e. in filled mode. I use vertex buffer initialized in OnInitialUpdate(). Antialiasing is off.
|
|
|
|
|
So you are using Direct3D DM? You should realize that lines are actually very thin polygons in Direct3D - so as to minimize the calling structures. This may be the root of the problem.
This sounds like you are transforming the viewport instead of the projection matrix as a response to changing of the window size.
If not, There are also hardware accelerator problem sometimes - check to see if it does the same thing on a different video card - or turn off hardware acceleration in the Windows display options.
|
|
|
|
|
Is there an API call that can be used to detect if the system is Shutting down/Restarting or Logging Off.
I've got a program that runs as a scheduled task, and sometimes when the user logs off, the Program Wait...End Now comes up or the "application couldn't start because the terminal is shutting down", because the scheduled task is started each 5 minutes. I want to prevent the error, is there anything I can do?
|
|
|
|
|
Have a look at WM_QUERYENDSESSION:
WM_QUERYENDSESSION
The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls the ExitWindows function. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.
After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
WM_QUERYENDSESSION
nSource = (UINT) wParam;
fLogOff = lParam Parameters
nSource - Reserved for future use.
fLogOff - Value of lParam. Indicates whether the user is logging off or shutting down the system. Supported values include: ENDSESSION_LOGOFF.
Return Values
If an application can terminate conveniently, it should return TRUE; otherwise, it should return FALSE.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Good Morning,
I am developing an application in MFC VC++ Version 6.0 for Windows 2000
I need some help.
How can we convert CSTring to LPCSTR
I have a function in which I neet to pass LPCSTR type agument.
myprogram()
{
CString str;
//
//how to convert this str to LPCSTR
//
myfunc(str)---???
}
myfunc(LPCSTR str)
{
....
....
...
}
Waiting for a positive response.
Rohit
|
|
|
|
|
|
here's the solution..
myprogram()
{
CString str;
//
//how to convert this str to LPCSTR
//
myfunc(LPCSTR(str))---???
}
myfunc(LPCSTR str)
{
....
....
...
}
___________________________
When a thing is new, people say, "It's not true." Later, when its truth becomes obvious, people say, "It's not important." Finally, when its importance cannot be denied, people say, "Well, it's not new."
|
|
|
|
|
hi,
my exact code is:
myprogram()
{
CString EZBuf;
EZBuf.Format("%sEZBuf",HardDiskLetters[iCounter]);
//where HardDiskLetters[iCounter] = c:\\
DelTree((LPCSTR)EZBuf);
}
DelTree(LPCSTR path)
{
...
}
////////////////////////////////
Deltree function is used to remove the directory
I tried your method but it didnot worked.
On other hand if i pass c:\EZBuf in the function then the program works fine
/////////////////////////////////
Can anybody tell where the problem is ??
Rohit
|
|
|
|
|
check out ur HardDiskLetters.. i sur harddisk letter is "C:" hten u need to add '\\' in ur code EZBuf.Format("%s\\EZBuf",HardDiskLetters[iCounter]);
in any case, final string in 'EZBuf' should be "C:\dir_name"
try it out..
Bhaskar
___________________________
When a thing is new, people say, "It's not true." Later, when its truth becomes obvious, people say, "It's not important." Finally, when its importance cannot be denied, people say, "Well, it's not new."
|
|
|
|
|
BhaskarBora wrote:
When a thing is new, people say, "It's not true." Later, when its truth becomes obvious, people say, "It's not important." Finally, when its importance cannot be denied, people say, "Well, it's not new."
LOL! True!
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
hi ,
I tried both ways but it didnot worked.
void myfun()
{
CString str;
str.Format("%sEZBuf",HardDiskLetters[iCounter]);
DelTree(str); //doesnot works
DelTree((LPCSTR)str); // doesnot works
DelTree("c:\\EZBuf"); //Works
}
DWORD DelTree(LPCSTR pszBase)
{
SHFILEOPSTRUCT sFileOp;
ZeroMemory(&sFileOp, sizeof(SHFILEOPSTRUCT));
sFileOp.wFunc = FO_DELETE;
sFileOp.pFrom = pszBase;
sFileOp.fFlags = FOF_SILENT|FOF_NOCONFIRMATION|FOF_NOERRORUI;
SHFileOperation(&sFileOp) ;
return 0;
}
|
|
|
|
|
your problem is that - in 'sFileOp.pFrom' the list of names must be double null-terminated!!!
with:
str.Format("%sEZBuf%c",HardDiskLetters[iCounter],'\0');
your function will work fine.
CC.
|
|
|
|
|
Great brain.. Constantin.
Thanks a lot.
|
|
|
|
|
Hi,
I think just with a casting could be enough ?
CString Mystring;
myfunc((LPCSTR) Mystring);
If not, try this:
CString MyString;
myfunc(MyString.GetBuffer(0));
MyString.ReleaseBuffer();
HTH
Braulio
|
|
|
|
|
try using the Cstring::operator LPCSTR();
i.e.
yourfunc(str.operator LPCSTR());
yourfunc(LPCSTR str)
{
...
...
}
|
|
|
|
|
It would be nice if your explanation could describe whether this error was a syntax or semantic error. From your description, most people with a good english understanding would have thought that "does not work", implies a syntax compiler error, however, from constantin's solution I can see you actually meant "does not work" in a semantic sense where the function does not operate how you expect it to. It would be great if people could do this in their questions to stop nutters like me barking up the wrong tree, racking my brains for a solution that doesn't exist .
Alan.
|
|
|
|
|
Dear Alan,
Will definately take care from now onwards,
Rohit
|
|
|
|
|
hello all
When user click on a link, then how to get information of that link (eg : IP address) and how to block that IP (user can't go to that site).
sorry all, i'm not good in English.
|
|
|
|
|
Are you sure you want the C++ forum for this?
Sounds more like a web question.
Jason Henderson "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it."
- Jack Handey
|
|
|
|