1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| void CApplication::LoadData()
{
HANDLE data;
data = CreateFile("Data\\InitData.eas",0,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if( data != INVALID_HANDLE_VALUE)
{
data = CreateFile("Data\\InitData.eas",GENERIC_READ,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
int buf1;
float buf2;
buf1=0;
buf2=0.0;
unsigned long ultemp;
ReadFile(data, &buf1,sizeof(buf1),&ultemp,NULL);
m_Long=buf1;
ReadFile(data, &buf1,sizeof(buf1),&ultemp,NULL);
m_Larg=buf1;
ReadFile(data, &buf1,sizeof(buf1),&ultemp,NULL);
m_X=buf1;
ReadFile(data, &buf1,sizeof(buf1),&ultemp,NULL);
m_Y=buf1;
ReadFile(data, &buf2,sizeof(buf2),&ultemp,NULL);
m_Separation=buf2;
ReadFile(data, &buf2,sizeof(buf2),&ultemp,NULL);
m_Separation2=buf2;
}
else
{
data = CreateFile("Data\\InitData.eas",GENERIC_WRITE,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
int buf1;
float buf2;
unsigned long ultemp;
buf1 = 600;
WriteFile(data, &buf1,sizeof(buf1),&ultemp,NULL);
buf1 = 400;
WriteFile(data, &buf1,sizeof(buf1),&ultemp,NULL);
buf1 = (GetDeviceCaps(GetDC(NULL), HORZRES) - 600) / 2;
WriteFile(data, &buf1,sizeof(buf1),&ultemp,NULL);
buf1 = (GetDeviceCaps(GetDC(NULL), HORZRES) - 400) / 2;
WriteFile(data, &buf1,sizeof(buf1),&ultemp,NULL);
buf2 = 0.66;
WriteFile(data, &buf2,sizeof(buf2),&ultemp,NULL);
buf2 = 0.5;
WriteFile(data, &buf2,sizeof(buf2),&ultemp,NULL);
}
CloseHandle(data);
} |
Partager