Exp=M
ModuleFileName=SoftKey.h
@end
 
#include "my3l_ex.h"
#include <time.h>
#pragma once

#pragma comment (lib,"my3l_ex.lib")                                      

namespace ytSoftKey
{
	#define YTFREE(_string)  Marshal::FreeHGlobal(System::IntPtr((void*)_string))
	#define YTMALLOC(_string) ( char*)(Marshal::StringToHGlobalAnsi(_string)).ToPointer()
	using namespace System;
	using namespace System::Runtime::InteropServices;
	char KeyPath[260];
	TCHAR E_Hkey[20];//ڴӼжȨŵĸ4λ
	TCHAR E_Lkey[20];//ڴӼжȨŵĵ4λ
	int LastError;//ȫֱ
	public __gc class SoftKey 
	{	
	 public:
		
		SoftKey()
		{
			LastError=0;
			ZeroMemory(KeyPath,sizeof(KeyPath));
		}
		
		//ĿģǷûдڣʾûû
		#Ini#

		#Ini_2#

		#compare#

		#YAdd#

		#YCheckKey#

		#YCompareString#

		#YCompareStringNoCase#

		#YDecrease#

		#YDivide#

		#Ymultiply#

		#YSetValue#

		#Ystrcat#

		#Ystrcpy#

		#Ystrncat#

		#YAnd#

		#Yor#
		
		//GetLastError
		//ĿģȡĴ룬Ϊ0ʾûд
		//ؽĴ
		int YGetLastError()
		{
			return LastError;
		}

		
		
	protected:
		 
		void Dispose(Boolean disposing)
		{
	
		}
		//ȡָеȨ
	BOOL F_ReadKey(TCHAR *E_Hkey,TCHAR *E_Lkey)
	{
		BYTE ArrayKey[8];DWORD d_hkey,d_lkey,temp_a,temp_b,temp_c,temp_d;
		int n;
		for (n=0;n<8;n++)
		{
			if(YReadEx(n,&ArrayKey[n],KeyPath)!=0)return FALSE;
		}
		temp_a=ArrayKey[0];temp_b=ArrayKey[1]; temp_c=ArrayKey[2]; temp_d=ArrayKey[3];
		d_hkey=temp_a|(temp_b<<8)|(temp_c<<16)|(temp_d<<24);
		temp_a=ArrayKey[4];temp_b=ArrayKey[5]; temp_c=ArrayKey[6]; temp_d=ArrayKey[7];
		d_lkey=temp_a|(temp_b<<8)|(temp_c<<16)|(temp_d<<24);
		ltoa(d_hkey,E_Hkey,16);ltoa(d_lkey,E_Lkey,16);
		return TRUE;
	}

	};
}

