Does anyone know here I can find information on thread and stream programming in c++? I'm not a begginer in programming threads and streams, I have coded both in Visual Basic and java but I'm new to this topic in c++.
Printable View
Does anyone know here I can find information on thread and stream programming in c++? I'm not a begginer in programming threads and streams, I have coded both in Visual Basic and java but I'm new to this topic in c++.
MSDN has plenty of info. Look up CreateThread in the Platform SDK.
For streams, do you mean like iostreams? Or multimedia streaming?
Streams to other computers through say tcp/ip and to multimedia devices would be great.
So Winsock programming then :)
MSDN has some info, and this may help at planetsourcecode -- not checked it, though (i have a really slow connection)
http://www.planet-source-code.com/vb...=1141&lngWId=3
Thank you very much, Parksie.
Okay...here's a quick example of threads:
PHP Code:#include <windows.h>
#include <iostream>
using namespace std;
DWORD __stdcall ThreadFunc(void *pParam) {
cout << "In the thread!" << endl;
Sleep(5000);
return 0; // Exit from thread
}
void main(int argc, char **argv) {
unsigned long lThreadId;
HANDLE hThread;
hThread = CreateThread(NULL, 0, ThreadFunc, NULL, 0, &lThreadId);
if(hThread == NULL) {
cout << "Could not create thread\n";
return;
}
Sleep(2500);
cout << "Main thread" << endl;
Sleep(3000); // Give B a chance to finish
CloseHandle(hThread);
}
Thanks again.
Multithreading is one of the most complex areas of windows programming. Here is an example in Multithreading. (the comments are not in english).
Nice code Vlatko...very nice.
...not so sure about the MFC, though ;)