Friday, May 21, 2010

How to implement asynchronous function callback in pure win32 programming?

I just need a basic idea of accomplishing this task. No MFC, please.

How to implement asynchronous function callback in pure win32 programming?
Basic idea. Say you are reading a big file and you don't want the code to block and you can continue to work on something else while the file is reading.





ReadFileEx (hFile, pBuffer, 1024, %26amp;overlapped, Callback);





// do other stuff...


// now wait for the file reading to complete


do


{


SleepEx (INFINITE, TRUE);


} while (!bDone);








Callback()


{


bDone = true;


}


No comments:

Post a Comment