Feb 27th, 2001, 02:49 PM
#1
Thread Starter
New Member
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++.
Feb 27th, 2001, 02:50 PM
#2
Monday Morning Lunatic
MSDN has plenty of info. Look up CreateThread in the Platform SDK.
For streams, do you mean like iostreams? Or multimedia streaming?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Feb 27th, 2001, 02:52 PM
#3
Thread Starter
New Member
Streams to other computers through say tcp/ip and to multimedia devices would be great.
Feb 27th, 2001, 02:55 PM
#4
Monday Morning Lunatic
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
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Feb 27th, 2001, 02:56 PM
#5
Thread Starter
New Member
Thank you very much, Parksie.
Feb 27th, 2001, 03:00 PM
#6
Monday Morning Lunatic
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 );
}
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Feb 27th, 2001, 04:36 PM
#7
Thread Starter
New Member
Feb 28th, 2001, 12:05 PM
#8
Frenzied Member
Multithreading is one of the most complex areas of windows programming. Here is an example in Multithreading. (the comments are not in english).
Attached Files
Feb 28th, 2001, 02:45 PM
#9
Monday Morning Lunatic
Nice code Vlatko...very nice.
...not so sure about the MFC, though
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width