|
You did understand what you were told in VB forum?
Windows will interrupt your code whether you want it to or not. That is what is meant by 'pre-emptive' Operating System.
The windows scheduler has a resolution of about 15ms and it will mess up all attempts to get reliable timing shorter than what the scheduler has. Believe me this is not a trivial task. see here.
I also prefer to use the following method..
"If you do a Sleep(), you might hope that when you regain control you are probably pretty soon after a clock tick. So assume that, reading the counter immediately after a Sleep(), and repeat several times, taking the earliest counter value recorded to be the counter value at the tick. This method will have a small but hopefully constant offset; it's the best we can do, at least in user space (more may be possible as a driver, using the DDK KeQuery* functions; we haven't investigated this)."
I just average a counter over several milliseconds (less than the quantum of the scheduler's 15ms) and divide it by 1,000 or 1,000,000 to get a rough sub-ms delay. Not ideal but it obtains a reliable value when the NT scheduler is running.
there is some downloadable C source code from the following link.
www.lochan.org/2005/keith-cl/useful/win32time.html
modified 10-May-13 17:45pm.
|
|
|
|
|
The windows timer has a granularity of about 10 or so milliseconds, so unless you create your own HW that interrupts every few micro seconds, in which case you will kill system performance, the only solution is s dead loop count.
Of course if your thread get descheduled, and it will be by kernel code even if you give it a high priority, then your timing will be off, but it might give you enough accuracy.
==============================
Nothing to say.
|
|
|
|
|
hello everybody :
anyway i am working on program that use alot of object
if i want to compare in (if statement) like
if(ob.x==ob1.x)
if(ob.x != ob1.x) do i need to overload these operators or not (because visual studio says no operator match ,
if yes could you tell me the code with simple explain
thanks anyway .
|
|
|
|
|
|
Assuming x is an object of type X , you will need to overload the == and != operators in class X .
class X
{
bool operator ==(const X& rhs)
{
return this.var == rhs.var ? true : false;
}
bool operator !=(const X& rhs)
{
return this.var == rhs.var ? false : true;
}
};
The comparison logic would really depend on your particular business case.
|
|
|
|
|
an if X where object from struct not from class ,will the use of this be true????
|
|
|
|
|
struct and class are the same in C++.
Only difference is that, by default, class members are private and struct members are public .
|
|
|
|
|
but there is problem :
this .x
x is a member in struct not in class , and the hole struct is a private member of class
and the overload i need it for object of struct , not the class,
so that compiler tel me that x is not a member of class,
( error class y has no member x,
|
|
|
|
|
Overload the operators inside the struct.
|
|
|
|
|
Hello,
I cannot find IACLCustomMRU in any header.
Same thing for associated constant : IID_IACLCustomMRU
Thanks in advance.
|
|
|
|
|
|
Find what ?!
There is nothing in MSDN doc about declarations, include files, IID_IACLCustomMRU
constant, etc ...
|
|
|
|
|
I guess you need to ask Microsoft.
Use the best guess
|
|
|
|
|
hello every body:
i made some java courses last years , i found that i can make a GUI by includeing some library , like import " javax.swing "
anyway this is just in java, i want to ask is there anything like that in C++ , as java is close to C++,
if there is i want to tell me how to do something like that i visual studio ,and if you know some resource i will be happy if you share it ,
thanks
|
|
|
|
|
OmarSH wrote: ...as java is close to C++... They are similar in syntax only, nothing else.
OmarSH wrote: if there is i want to tell me how to do something like that i visual studio If you have VS installed, just click the Create button. In the "New Project" dialog, select something under Visual C++ like MFC or Win32.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Pure C++ does not support creating GUIs.
C++ is meant for creating optimized, reusable libraries.
However, you can use some frameworks or libraries that are based on C++ like MFC as David mentioned.
This would, however, be OS dependent.
Some libraries like QT[^] provide source code compatibility between OSs where you write code once and build the same code on different environments.
|
|
|
|
|
«_Superman_» wrote: Pure C++ does not support creating GUIs.
C++ is meant for creating optimized, reusable libraries.
Really? I wonder how I've neen doing it all these years then?
Use the best guess
|
|
|
|
|
Richard MacCutchan wrote: Really? I wonder how I've neen doing it all these years then?
might be late!!... you might be writing executable in disguise of library
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi, I placed bitmap file and source code in same folder.
I use:
hBitmap = SHLoadDIBitmap(_T(".\zzz01.bmp"));
try to load the bit map, but it can't load it.
|
|
|
|
|
That's probably because the executable program does not get written to the same folder as the source code. Your bitmap should be copied to the Debug or Release folder in the solution directory.
Use the best guess
|
|
|
|
|
econy wrote:
hBitmap = SHLoadDIBitmap(_T(".\zzz01.bmp")); You are using a relative path. If you just want to find out if your "load" code works, use an absolute path instead. If that works, then you can study the difference between the two.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
try using absolute path by using API GetModuleFileNameW
WCHAR path[MAX_PATH];
GetModuleFileNameW(NULL, path, MAX_PATH);
this will return you the path to your executable, you have to strip filename from this and replace it with your bitmap
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
I am working on a project in which I am using DirectX to play , pause or stop videos.
Video display is fine on windows XP, windows 7.....But when I run my application and play the same video on Windows 8 machine, video display gets corrupted.....The whole video turns greyish.
The screen doesn't display any other color except grey.
Anybody have any idea about this issue.?
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
It's hard to guess based on the little information you have provided, but it is possible the graphics card/driver does not support the particular pixel format (YUY2, UYVY, etc.) your program is trying to use.
Check in the code where the primary surface is being created and see which pixel format is being used.
This was something we had problems with 10 years ago, but I imagine you could run into it with Windows 8 since that is still fairly new and some drivers might need more work.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
Hi,
First all I want to thank all for the help with exception resulting from the CWnd::SendWIndow
seemed it had a errorous pointer as in the lparam
my_event->buffer_ptr
I have done research on the Streamin Call Back function of rich edit but I haven't gotten it to work
I am trying to read into my RichEdit a MainFrame Assembler program Listing
I have a few questions
1) how do you terminate the callback the doc says set *pcb = 0; I did that call back function was still called after that
2) to set things on separate lines I add carriage return '/r' line feed '/n' at the end of each line is this correct
3) How does the framework set (or can I set the value of cb) number of bytes to read
Thanks
|
|
|
|