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;
}
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;
}