|
Hi All,
Will you please give me one solution to change the caption of balloon tooltip that will be shown when a device is connected?
Regards,
Spk
|
|
|
|
|
Maybe you can hook the balloon tooltip window and change it.
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 9:00am.
|
|
|
|
|
Hi all,
How to change the button style to default button.
Thanks
|
|
|
|
|
|
|
Try this function CButton::SetButtonStyle()
|
|
|
|
|
Can you use CDialog::SetDefID() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
HI ,
this is a question purely related to C programming.
I am calculating a division between two float numbers e.g 4.00 / 3.00.
Now if i answer 1.3333 , the functions returns that it is wrong.
i just want to know how to truncate in Float values in C ???
here is the copy of the code:
float d1,d2,d3;
main( )
{
srand(time(0)); // Initialize random number generator.
ans = 1;
while ( ans != 0 )
{
/// starting of For loop ////////////////
wrg =0;
for ( cnt=0;cnt<3;cnt++) {
d1 = float(rand()%x+2 );
d2 = float(rand()%x+2) ;
printf("\n\t Solve this %f / %f :.........\n", d1, d2 );
scanf("%f", &d3);
divid_cheque(d1,d2,d3);
}// ending for loop
printf("\n\t Do you want to continue........\n");
printf("\n\t Type 1 = continue or 0 = to terminate \n");
scanf("\n\t%d", &ans);
}
printf("\n Total number of wrong answers : %d out of %d \n\n", wrg, cnt);
return 0;
}
//////////////////////Division(/) Function defined//////////////////////////////////////////////////////////////////
//unsigned int division( unsigned int y, unsigned int z, unsigned int x )
// unsigned int divid_cheque( unsigned int j, unsigned int k, float l)
// int divid_cheque( float j, float k, float l )
int divid_cheque( float j, float k, float l )
{
float as;
as=j/k;
if ( l== as )
printf("\n \t Right answer..........\n");
if ( l != as ) {
printf(" \n \t << WRONG ANSWER >> \n");
printf("\n \t the right answer is = %f",as);
wrg++ ; // incrementing counter for wrong answers
}
else
return (wrg);
}
////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
When doing comparisons with calculated float values, you generally need to decide how close is close enough. Take the absolute value of the difference between the two and see if it is less than some epsilon value which is your tolerance for "exactness".
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
truncate at which decimal place ?
float f1 = 4./3.;
float f2 = (float)((int)(f1 * 1000.0)) / 1000.0;
|
|
|
|
|
The number of digits in a float after the decimal point cannot be truncated.
You can only limit the number of digits that you want displayed.
For example printf("%6.4f", 4.0/3.0); will display 1.3333.
|
|
|
|
|
Hello
i use the following in order to truncate a double value (found somewhere and modified )
However you must be careful in here, because there could be an overflow in double fac = Num/Seed
#include <math.h>
#include <stdio.h>
double truncate(double Num, double Seed)
{
double fac = Num / Seed;
fac = (fac < 0) ? (ceil(fac)) : (floor(fac));
return fac * Seed;
}
int main()
{
double val = 4./3.;
printf("%6.4f\n",truncate(val,1e-04));
return 0;
}
|
|
|
|
|
How do I go about using a managed DLL (C#.NET DLL) in unmanaged C++?
I found a really cool open source C#.NET library that would be nice to use in a C++ app I am working on. I am trying to get better with C++...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Sure you may find better help in the managed C++ / CLI [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Hi everybody,
i have been working on a step controller program,
and i succeed to control, but i cant run the step motors as fast as i want
i am using the Sleep(1) function in "windows.h" to delay next step, but it is still so slow
i need something like Sleep(0.05) ,
is there someone who can suggest me a method to do this job?
thanx,
--always comes daylight after night-----
|
|
|
|
|
|
Which operating system are you running ? You know that windows is not a real-time operating system ? This means that having an accuracy of 1 msec is not possible (it is generally in the range of 10 msec).
You will need to use a real-time OS in order to achieve what you are looking for.
|
|
|
|
|
i am using win7
i just need to sleep my comp for a very short time
--always comes daylight after night-----
|
|
|
|
|
If you need an accuracy of 1msec or less (or even 10 msec), then windows is not the right choice because it is not a real-time OS. Please, look at the article Nemanja provided.
If you need to control hardware and need to have a high accuracy, you will need to switch to a real-time OS instead.
|
|
|
|
|
thanx
i appriciate your answers
--always comes daylight after night-----
|
|
|
|
|
Adnan Merter wrote:
is there someone who can suggest me a method to do this job?
Yes, use a microcontroller.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thank you
but, it is hard to input data to microcontroller instantly
it is not user-frienly
i need to run upto 8 motors at the same time and
also, i am not good at programming pics
i have to use computer
--always comes daylight after night-----
|
|
|
|
|
Adnan Merter wrote: it is hard to input data to microcontroller instantly
Why do you need to input data instantly to the microcontroller?
Adnan Merter wrote: it is not user-frienly
i need to run upto 8 motors at the same time and
also, i am not good at programming pics
I've done it (just one motor, though, a long time ago), using 8051, it is amusing.
Adnan Merter wrote: i have to use computer
No you don't need. However, if you really want to use a PC then you have to either write kernel-space code or use a real time operative system. Both choices are not painless.
Good luck.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
whatever sleep() function you use, you will get a stand-still for at least the time you specify, however it could be much longer as there are dozens of threads all running on a typical Windows system.
The only scheme that might work to some extent is this:
- assume a multi-core system;
- create a program (or a thread in an existing program) that contains busy loops, so it is simply getting and checking time all the time, then setting the output(s) as required. Of course you need a high-precision timer, maybe the PerformanceCounter stuff.
- make sure to elevate the thread's priority to PRIO_REAL_TIME, so nothing else is likely to steal the core.
WARNING: it is quite a hack, I do not consider this good enough to provide steps to a stepper motor; steps will vary, resulting in horrible noise, and shaky operation. Also, as you are going to move something that may harm humans, you have to provide fail-safes; those cannot be trusted when their function also is based on your Windows app.
|
|
|
|