|
I would like to know how do u notify your dialog with progress control to update it self.
I am sure that this would have given u the solution to your problem.
One way of doing this is u send message to the dialog box to update when u update the global structure.
|
|
|
|
|
KKR wrote:
Any tutorials are avilable on Threads, Events ...online
http://www.flounder.com/mvp_tips.htm[^] has (among others) a very good tutuorial about threads.
Hope this helps!
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I am a nebie in VC++.
Currently i am doing a project which makes use of a webcam. But i do not know how to get the handle of the camera to begin with. Can anyone kindly tell me??
Thanks,
nwillie
|
|
|
|
|
Well, actually I don't even know what the problem is.
It's like this. I have a dialog box which reads some values from a file to initialize itself. I do this in OnInitDialog() . Fine. But when the dialog finally shows up, one of the checkboxes is not checked. I mean, it should have been, according to the settings it reads from the file. I checked the value just after reading the settings, to make sure that it's indeed getting read properly. It is. After ReadSettings() (my function which reads the settings and puts them in variables), the values are just what they should be. At the end of this function UpdateData(FALSE) is called to put these values in the controls on the dialog box to which they correspond. Things are just as they should be, except for one particular checkbox. And after UpdateData() the value of the variable is also somehow set to FALSE on its own. WTF is going on? When I try to change the settings or something, and write the new values back into the file, they get written properly, including for this checkbox. So the variable is properly connected to the control. But what happens during UpdateData(FALSE) ? Or am I looking at the problem in an entirely wrong way?
I'm not a newbie or anything. But this thing has me baffled. I must be missing something very very obvious and stupid. I very rarely ask for help, but in order to save the walls around me from developing cracks from banging my head on them, I must do so now.
Suggestions, please? I need to get this done today. Doh. Stupid me.
Regards,
Rohit Sinha
Do not wait for leaders; do it alone, person to person. - Mother Teresa
|
|
|
|
|
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)
{
...
...
}
|
|
|
|