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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
void CCalibDlg::CalibProcedure_1()
{
CMyApp* myapp = (CMyApp*)AfxGetApp();
MONITORINFO mi;
mi.cbSize = sizeof(mi);
int monitorWidth,monitorHeight,xinc,yinc;
int maxX = GetSystemMetrics(SM_CXVIRTUALSCREEN);
int maxY = GetSystemMetrics(SM_CYVIRTUALSCREEN);
GetMonitorInfo(GetMonitorHandle(device.d_Mon),&mi);
monitorWidth = mi.rcMonitor.right-mi.rcMonitor.left;
monitorHeight=mi.rcMonitor.bottom-mi.rcMonitor.top;
xinc = monitorWidth / 8;
yinc = monitorHeight / 8;
POINT cpt[9];
POINT cptd[9];
DWORD result;
int i,j,k=0;
for(i=1;i<8;i+=3)
{
for(j=1;j<8;j+=3)
{
cptd[k].x=(j*xinc+mi.rcMonitor.left)*0x400/maxX;
cptd[k].y=(i*yinc+mi.rcMonitor.top)*0x400/maxY;
// C LA QUE JE BOUGE LE BITMAP
c_Cross.SetWindowPos(NULL,j*xinc-30,i*yinc-30,60,60,NULL)
Invalidate();
UpdateWindow();
result=WaitForSingleObject(myapp->pSink->calibEvent,10000);
switch(result){
case WAIT_OBJECT_0:
cpt[k].x=myapp->pSink->cx;
cpt[k].y=myapp->pSink->cy;
break;
case WAIT_TIMEOUT:
i=j=k=9;
break;
}
k++;
}
}
if(k == 9)
{
SetRegistryBinaryValue(device.d_Num,"pt",cpt,72);
SetRegistryBinaryValue(device.d_Num,"ptd",cptd,72);
//RELANCER LE DEVICE
SetRegistryValue(device.d_Num,"CalibOK","1",4);
myapp->Wmi_SetMode((FLAG_SET_COM<<8)+device.d_Num);
}
else
{
CString info,text;
info.LoadString(IDS_INFO_TITLE);
text.LoadString(IDS_CALIB_FAIL);
MessageBox(text,info,MB_OK);
SetRegistryValue(device.d_Num,"CalibOK","0",4);
}
} |
Partager