怎样用Axapta读取Ini文件的数据

在某个class(比如可以加在winAPI中)中增加如下的方法,然后调用此方法即可。

 1 client static str getPrivateProfileString(str section, str key, str value, str file)
 2 {
 3     #WinAPI
 4     #define.sizeOfStringValue(1024)
 5     Binary stringValue;
 6     
 7     DLL         DLL       = new DLL(#KERNELDLL);
 8     DLLFunction method    = new DLLFunction(DLL, 'GetPrivateProfileStringA');
 9     stringValue           = new Binary(#sizeOfStringValue);
10    
11     method.returns(ExtTypes::DWord);
12     method.arg(ExtTypes::String,  //section
13     ExtTypes::String,  //key
14     ExtTypes::String,  //default value
15     ExtTypes::Pointer, //value
16     ExtTypes::DWord,  //Size
17     ExtTypes::String); //file
18  
19     method.call(section, key, value, stringValue, #sizeOfStringValue,file);
20  
21     return stringValue.string(0);
22 }

 

posted @ 2012-08-30 16:09  Sprite.z  Views(209)  Comments(0Edit  收藏  举报