how to create a new thread in c++ class: why i can not get output.

S

sun4216

the program is below, I print a string in the new thread ,but ir seems
nothing had happened : why ? can anybody tell me ? you help will alway
appreciate .

//main.cpp:
#include "stdio.h"

#include "program.h"
void main()
{
CProgram Prog;
Prog.ReadChip (88);
}

//program.h:
#include <windows.h>
#include "usb.h"

class CProgram
{
public:
CProgram();
virtual ~CProgram();
BOOL ReadChip(int readLen);
static DWORD WINAPI Read(LPVOID lpParam);
};


//program.cpp:
#include "Program.h"
#include "stdio.h"

CProgram::CProgram()
{
}
CProgram:: ~CProgram()
{
}

BOOL CProgram::ReadChip(int readLen)
{
DWORD ThreadIDProgram;
CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)Read,
(LPVOID)&readLen, 0, (LPDWORD)&ThreadIDProgram);
return 1;
}

DWORD WINAPI CProgram::Read(LPVOID lpParam)
{
printf("lpParam is:%d", *(int*)lpParam);
return 1;
}
 
A

Asfand Yar Qazi

sun4216 said:
the program is below, I print a string in the new thread ,but ir seems
nothing had happened : why ? can anybody tell me ? you help will alway
appreciate .

<snip>

Please ask this question in a Microsoft/Visual C++ newsgoup, as the
question is not relavent here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,696
Latest member
BarbraOLog

Latest Threads

Top