mrDarker
2025-07-16 1dbe46cd9d0f181d08d5a69f72d8548628a13b9d
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
// ExternLightControl.cpp: implementation of the CExternLightControl class.
//
//////////////////////////////////////////////////////////////////////
 
#include "stdafx.h"
#include "ExternLightControl.h"
 
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
 
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
 
CExternLightControl::CExternLightControl()
{
    m_nLightValue = 0;
}
 
CExternLightControl::~CExternLightControl()
{
//    CloseControl();
}
 
int CExternLightControl::Hex2Integer(const CString strHex, const int iCount)
{
    CString str = strHex.Left(iCount);
    
    CString hex(_T("0123456789abcdef"));
    
    int        cnv = 1;    
    int     dec = 0;
    
    for(int i=0 ; i<str.GetLength() ; i++)
    {
        dec += hex.Find(str.GetAt(str.GetLength()-1-i))*cnv;
        cnv *= 16;
    }
    return dec;
}