www.pudn.com > Racing.rar > Horse.h
#ifndef _HORSE_H_
#define _HORSE_H_
#include "windows.h"
enum COLOR {RED, GREEN, BLUE};
typedef struct _horse
{
HWND hWnd; //
int speed; // speed
int x, y; // position
COLOR color;
CRect rect; // rounding rect;
}HORSE, *LPHORSE;
extern char m_gRName[64] = "RedHorse";
extern char m_gGName[64] = "GreenHorse";
extern char m_gBName[64] = "BlueHorse";
UINT WINAPI ThreadProc(DWORD lpParam)
{
LPHORSE lpHorse;
HANDLE hMutex;
long speed;
lpHorse = LPHORSE(lpParam);
if( lpHorse->color == RED )
{
hMutex = ::OpenMutex(MUTEX_ALL_ACCESS, FALSE, m_gRName);
}
else if ( lpHorse->color == GREEN )
{
hMutex = ::OpenMutex(MUTEX_ALL_ACCESS, FALSE, m_gGName);
}
else if ( lpHorse->color == BLUE )
{
hMutex = ::OpenMutex(MUTEX_ALL_ACCESS, FALSE, m_gBName);
}
else
return 0; // ÑÕÉ«²»¶Ô
return 1;
}
#endif //_HORSE_H_