[RESOLVED] error on a code
Code:
#include <process.h>
#include <string>
#include <memory.h>
#include <windows.h>
using namespace std;
struct Blink
{
string Text;
int x;
int y;
int TextColor;
int BackColor;
};
unsigned __stdcall BlinkLoop(void *params)
{
Blink *p = static_cast<Blink *>(params);
char *EmptyText;
EmptyText=new char[ p->Text.length() ] ;
int i;
for( i=0;i<=(int)p->Text.length();i++)
{
EmptyText[i] = ' ';
}
EmptyText[i] ='\0';
HDC hDC=GetDC(GetConsoleWindow());
SetTextColor(hDC,RGB(0,255,0));
SetBkMode(hDC,TRANSPARENT);
while (true)
{
TextOut(hDC,p->x,p->y,p->Text.c_str(),(int)p->Text.length()+1);
Sleep(1000);
TextOut(hDC,p->x,p->y,EmptyText,(int)p->Text.length()+1);
Sleep(500);
}
return 0;
}
void TextBlink(string Text, int x, int y, int TextColor, int BackColor)
{
Blink *b;
b->Text=Text;
b->BackColor=BackColor;
b->TextColor=TextColor;
b->x=x;
b->y =y;
_beginthreadex(NULL, 0, BlinkLoop ,&b, 0, NULL);
}
i have 1(at least) error on thses code, but the compiler don't found it :(
only the windows "the program stops to working" and then close it.
can anyone advice me?