If your app is multi-threading, DoEvents of VB is not a correct solution.
The DoEvents function of VB does not handle multi-threading issues
but just processes pending WM_ window messages that are
not processed yet.
If you are really looking for an equivalent to DoEvents, use the following
macro. If using C compiler, remove doubled-semicolons, which can only
be recognised by C++ compiler.
// DoEvents-equivalent operation
#define DOEVENTS \
{MSG __msg; \
while( ::PeekMessage( &__msg, 0, 0, 0, PM_REMOVE)) { \
::TranslateMessage( &__msg); \
::DispatchMessage( &__msg); \
} \
}
If you want to release CPU, use multithreading API functions such as
Sleep(), WaitForSingleObject() etc...
Makoto
"lambert" wrote in message
news:
5065000000080000000B400000-1012609683000@exchange.ni.com...
> Hi, all
> Recently, I want to design a mulththreading testing program. I want
> to use "CreadThread" to build four threads. And to use the global
> variables to handshake the functionality of each thread. To avoid the
> halt of CPU or endless loop, there may have some method to release
> CPU. In VB, there have "DoEvents" function to release CPU. Does there
> have the similar function for LabWindows/CVI or in the Win32SDK ?
> If there have the similar function, would you give me a sample
> program to check the functionality ?
>
> Best regards,
> Lambert Lin