up.if use com interface ,it's quite good. but vb can not find a proper data type to receive BSTR. and free is also a big problem.anyway, to solve kyo1979 () 's problem, use similar99(迷路) method , and at the same time, use COM IF instead of common DLL.
对于VB的类型,不一定人人知道啊?
{
USES_CONVERSION; char keyi[9];
DES des;
int nLen=strleng((char*)instr);
int nNewLen = (nLen+6)/8*8;
strcpy(keyi,key);
char* lpBuf = (char*)malloc(nNewLen+1);
memset(lpBuf,'\0',nNewLen+1);
memcpy(lpBuf,instr,nLen);
des.decrypt (keyi,lpBuf,nNewLen/8);
lpBuf[nNewLen]='\0';
char* lp=new char[nNewLen+1];
memset(lp,'\0',nNewLen+1);
memcpy(lp,lpBuf,nNewLen);
return SysAllocString(A2OLE(lp));
}
but vb can not find a proper data type to receive BSTR. and free is also a big problem.anyway, to solve kyo1979 () 's problem,
use similar99(迷路) method , and at the same time, use COM IF instead of common DLL.