|
I am using Sleep(n) in my application which is giving me a lot of inaccuracy..almost 50millisec..My Threads call Sleep and so the synchronisation is lost...
this is causing many of my actions to go out of turn and calculations are getting too inaccurate...could anyone please give easy code to replace the Sleep and add it to my code...
Thanks in advance
Shreyas Ganesh
-- modified at 2:30 Wednesday 7th June, 2006
|
|
|
|
|
Which accuracy do you need to have ? If you look for an accuracy under 15 msec (approximately), then you can forget about it. Windows is not a real-time operating system and thus, you cannot have precision under 10 or 15 msec (depends of which version of windows you are using). If you don't need a so much precision but still want to have something better than Sleep, you can have a look at GetTickCount[^]. You'll be able to do something with it.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Shreyas Ganesh wrote: My Threads call Sleep and so the synchronisation is lost...
Use Synchronisation techniques instead of Sleep..
several synchronisation techniques are available here
CriticalSecction,
mutex,
semaphors, etc.
Use appropriate for efficiency and performance.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi to all,
I need a sample code or information regarding the following....(in win32)
create a dialog,place own window on it...
Thanking you
Manjunath S
|
|
|
|
|
|
Hi,
can we create a dialog and create a child window of our own class on that dialog (win32 applcation).
Manjunath S
|
|
|
|
|
|
best example create one projectWin32(Win32Project) with VS
whitesky
|
|
|
|
|
i face a problem
problem is that then i make dialog box in mfc and make its class and also make a menu then i add this menu to the the dailog box . menu contain two commands one for addition and one for updation.
i make second dialog box in mfc then i add some edit controls on it and make a class of this dailog box.
so when i click on addtion command on menu in first dialog box it display second dialog box
and when i click on updation command in menu then it will again display second dialog box but now i want that some edit controls are disabled that is they can not take value
how can i do this
plz help me whoever know this
thanks
ya u give solution but that is not solve my problem
i want to disable it from menu which is on first dailog box and i want to disable edit control on second dailog box so enablewindow demand of object and i declare object of that edit in second dialog box and in first it will not take that one
hi
-- modified at 2:28 Wednesday 7th June, 2006
|
|
|
|
|
for disable and enable controls use EnableWindow
whitesky
|
|
|
|
|
yar it will not so easy as i want to do it from menu to other dialog box
hi
|
|
|
|
|
so you need to Here[^]
whitesky
|
|
|
|
|
We have already provided a solution for your problem. What problem are you still facing
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
paras_s12 wrote: ya u give solution but that is not solve my problem
i want to disable it from menu which is on first dailog box and i want to disable edit control on second dailog box so enablewindow demand of object and i declare object of that edit in second dialog box and in first it will not take that one
Create the pointer of the Secoend dialog box into first one and access the elements/Objects through that pointer.
Hope i understood your problem.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
\\\\\\\\\\\\\\\\\\\plz help me \\\\\\\\\\\\\\\\\\
i made a class of the the first dailog box which contain menu as CAfterone
and made a class of second dialog box which contain edit boxes as CAgaindialog now i declare
CAgaindialog *pop; in the header file of the CAfterone
ass i declare it in CAfterone :: public CDialog (public mode)
////////////can i declare it any where or in the class
CAfterone :: public CDialog (public mode)////////////
then i use to call second dailog box from menu as
void CPasswordDlg::OnDel()
{
d.DoModal();
pop->GetDlgItem(IDC_EDIT)->EnableWindow(FALSE);
}
but it will not do job for me
hi
-- modified at 3:43 Wednesday 7th June, 2006
|
|
|
|
|
paras_s12 wrote: but it will not do job for me
Try to make the Variable as extern , initialise it properly before invoking the enablewindow api.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
as i make variable of edit control of the type CEdit how could i make it extern
d.DoModal();
pop->GetDlgItem(m_nemp)->EnableWindow(FALSE);
i take m_nemp as CEdit type and call it but it will give error that undefind in class one
hi
|
|
|
|
|
wrote: as i make variable of edit control of the type CEdit how could i make it extern
d.DoModal();
pop->GetDlgItem(m_nemp)->EnableWindow(FALSE);
i take m_nemp as CEdit type and call it but it will give error that undefind in class one
I mean make extern variable of the second dialog box.
access it after initialisation.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi gurus,
what is the difference between following statements
int *p[10];
int (*p)[10];
what is the memory structure for both?
How to access the elements?
Thanks in advance..
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
int *p[10];
it is a two dimensional array and its elements can be accessed as
p[0][0],p[0][1].....
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 2:25 Wednesday 7th June, 2006
|
|
|
|
|
AnShUmAn wrote: int *p[10];
it is a two dimensional array and its elements can be accessed as
p[0][0],p[0][1].....
i think int *p[10] is array of 10 pointers.. am i right?
where we have to allocate the memory for each..
Knock out 't' from can't,
You can if you think you can
-- modified at 2:27 Wednesday 7th June, 2006
|
|
|
|
|
See for int *p[10];
<br />
int *p[2];<br />
memset(&p,0,sizeof(int[2]));<br />
<br />
int b=10;<br />
p[0]=&b;<br />
int c;<br />
c=20;<br />
p[1]=&c;<br />
<br />
int A;<br />
A=*p[0];<br />
A=*p[1];<br />
whitesky
|
|
|
|
|
int *p[10]
is a array of 10 pointers.
and i think second one is pointer to an array of 10 integers.
or you may declare it as int **p
assign memory to *p of 10 blocks so it will be an array
and then **p will be the pointer to array of 10 integers.
Leya
|
|
|
|
|
Since in operator precedence the "[] " operator has a priority above the "* " operator, the expression "int *p[10] " denotes an array of ten pointers, each pointing to an integer. In "int (*p)[10] " the order of interpretation was changed, and here we have a pointer to an array of ten integers.
In the first case, the size of p is 40 bytes (in our compiler), in the second case, the size is 4 bytes.
In the first case, you can assign new value for each array element like this:
p[2] = &z;
p[7] = new int;
Expression like *p[2] here can be used to change the value of z :
*p[2] = 100;
In the second case, you first have to allocate an array and assign its address to the pointer:
p = (int (*)[10]) new int [10];
Now you can access elements from this array:
(*p)[3] = 100;
(*p)[5] = 200;
Then you can delete the array:
delete [] p;
|
|
|
|
|
Viorel wrote: p = (int (*)[10]) new int [10];
Is it necessary to typecast the allocated memory ??
As per my knowledge the new operator returns the appropriate pointer.
or Should we allocate memory as
p = new int [5][10];
Knock out 't' from can't,
You can if you think you can
|
|
|
|